Unix.st
author Claus Gittinger <cg@exept.de>
Sat, 04 Oct 1997 19:01:30 +0200
changeset 2998 930360fb3f12
parent 2995 07f6017880ec
child 3000 58ea014c14e1
permissions -rw-r--r--
#size is not really obsolete
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     1
"
5
67342904af11 *** empty log message ***
claus
parents: 3
diff changeset
     2
 COPYRIGHT (c) 1988 by Claus Gittinger
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
     3
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     4
a27a279701f8 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
a27a279701f8 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
a27a279701f8 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
a27a279701f8 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
a27a279701f8 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
a27a279701f8 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
a27a279701f8 Initial revision
claus
parents:
diff changeset
    11
"
a27a279701f8 Initial revision
claus
parents:
diff changeset
    12
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
    13
'From Smalltalk/X, Version:3.1.10 on 13-sep-1997 at 10:53:39 pm'                !
2834
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
    14
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    15
Object subclass:#OperatingSystem
798
90a518c71a7f recursiveRemoveDirectory does not print garbage to stderr any longer; computeDateAndTimeFrom: now returns the utcOffset
Stefan Vogel <sv@exept.de>
parents: 792
diff changeset
    16
	instanceVariableNames:''
2131
1eeb310e109a newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
    17
	classVariableNames:'HostName DomainName LastErrorNumber OSSignals SlowFork ForkFailed
1eeb310e109a newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
    18
		ErrorSignal AccessDeniedErrorSignal FileNotFoundErrorSignal
2939
b7cebf237308 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2937
diff changeset
    19
		InvalidArgumentsSignal LocaleInfo CurrentDirectory
b7cebf237308 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2937
diff changeset
    20
		UnsupportedOperationSignal'
798
90a518c71a7f recursiveRemoveDirectory does not print garbage to stderr any longer; computeDateAndTimeFrom: now returns the utcOffset
Stefan Vogel <sv@exept.de>
parents: 792
diff changeset
    21
	poolDictionaries:''
90a518c71a7f recursiveRemoveDirectory does not print garbage to stderr any longer; computeDateAndTimeFrom: now returns the utcOffset
Stefan Vogel <sv@exept.de>
parents: 792
diff changeset
    22
	category:'System-Support'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    23
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    24
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
    25
Object subclass:#FileStatusInfo
2617
06d1b7337a33 added the alternativeName to the fileInfo (MSDOS name under NT)
Claus Gittinger <cg@exept.de>
parents: 2616
diff changeset
    26
	instanceVariableNames:'type mode uid gid size id accessed modified statusChanged path
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
    27
		alternativeName recordFormatNumeric recordFormat recordAttributes
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
    28
		fixedHeaderSize recordSize'
2131
1eeb310e109a newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
    29
	classVariableNames:''
1eeb310e109a newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
    30
	poolDictionaries:''
1eeb310e109a newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
    31
	privateIn:OperatingSystem
1eeb310e109a newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
    32
!
1eeb310e109a newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
    33
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
    34
Object subclass:#OSProcessStatus
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
    35
	instanceVariableNames:'pid status code core'
1966
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
    36
	classVariableNames:''
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
    37
	poolDictionaries:''
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
    38
	privateIn:OperatingSystem
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
    39
!
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
    40
437
claus
parents: 434
diff changeset
    41
!OperatingSystem primitiveDefinitions!
406
claus
parents: 384
diff changeset
    42
%{
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
    43
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
    44
#define UNIX_LIKE       /* assumption: a real operatingSystem */
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
    45
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
    46
#if defined(MSWINDOWS) || defined(OS2) || defined(MSDOS) || defined(WIN32)
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
    47
# ifndef MSDOS_LIKE
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
    48
#  define MSDOS_LIKE
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
    49
# endif
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
    50
# undef UNIX_LIKE       /* oops - we were too optimistic - no OS */
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
    51
# ifdef i386
2995
07f6017880ec win32 changes
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
    52
#  ifndef _X86_
07f6017880ec win32 changes
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
    53
#   define _X86_
07f6017880ec win32 changes
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
    54
#  endif
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
    55
# endif
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
    56
#endif /* any MS-non-OS */
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
    57
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
    58
#if defined(transputer)
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
    59
# undef MSDOS_LIKE
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
    60
# undef UNIX_LIKE       /* oops - we were too optimistic - no OS */
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
    61
#endif
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
    62
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
    63
#if defined(_AIX)
439
claus
parents: 438
diff changeset
    64
# ifndef WANT_REALPATH
claus
parents: 438
diff changeset
    65
#  define WANT_REALPATH
claus
parents: 438
diff changeset
    66
# endif
513
0347f6d11d76 interruptable system() on AIX
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
    67
# ifndef WANT_SYSTEM
0347f6d11d76 interruptable system() on AIX
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
    68
#  define WANT_SYSTEM
0347f6d11d76 interruptable system() on AIX
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
    69
# endif
406
claus
parents: 384
diff changeset
    70
#endif
claus
parents: 384
diff changeset
    71
433
f74d003548dc system-fix
claus
parents: 424
diff changeset
    72
#ifdef LINUX
1142
3964108b86ca *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1135
diff changeset
    73
  /* use inline string macros */
3964108b86ca *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1135
diff changeset
    74
# define __STRINGDEFS__
3964108b86ca *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1135
diff changeset
    75
# include <linuxIntern.h>
3964108b86ca *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1135
diff changeset
    76
439
claus
parents: 438
diff changeset
    77
# ifndef WANT_SYSTEM
claus
parents: 438
diff changeset
    78
#  define WANT_SYSTEM
claus
parents: 438
diff changeset
    79
# endif
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
    80
# define WANT_SHM
433
f74d003548dc system-fix
claus
parents: 424
diff changeset
    81
#endif
f74d003548dc system-fix
claus
parents: 424
diff changeset
    82
511
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
    83
#ifdef IRIX5
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
    84
# define WANT_SYSTEM
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
    85
#endif
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
    86
514
81fa80a953e2 system() now interruptable with ultrix
Claus Gittinger <cg@exept.de>
parents: 513
diff changeset
    87
#ifdef ultrix
81fa80a953e2 system() now interruptable with ultrix
Claus Gittinger <cg@exept.de>
parents: 513
diff changeset
    88
# define WANT_SYSTEM
81fa80a953e2 system() now interruptable with ultrix
Claus Gittinger <cg@exept.de>
parents: 513
diff changeset
    89
#endif
81fa80a953e2 system() now interruptable with ultrix
Claus Gittinger <cg@exept.de>
parents: 513
diff changeset
    90
515
43d76695a662 interruptable system() on hpux
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
    91
#ifdef hpux
43d76695a662 interruptable system() on hpux
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
    92
# define WANT_SYSTEM
43d76695a662 interruptable system() on hpux
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
    93
#endif
43d76695a662 interruptable system() on hpux
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
    94
1588
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
    95
#ifdef solaris
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
    96
# define WANT_SYSTEM
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
    97
#endif
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
    98
805
850571f0255f WANT_SYSTEM for unixware.
Stefan Vogel <sv@exept.de>
parents: 803
diff changeset
    99
#if defined(SYSV4) && defined(i386) /* e.g. unixware */
520
9620f7dc79d2 interruptable system() on unixware - should now move WANT_SYSTEM into xxxIntern files
Claus Gittinger <cg@exept.de>
parents: 515
diff changeset
   100
# define WANT_SYSTEM
9620f7dc79d2 interruptable system() on unixware - should now move WANT_SYSTEM into xxxIntern files
Claus Gittinger <cg@exept.de>
parents: 515
diff changeset
   101
#endif
9620f7dc79d2 interruptable system() on unixware - should now move WANT_SYSTEM into xxxIntern files
Claus Gittinger <cg@exept.de>
parents: 515
diff changeset
   102
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   103
#ifdef __VMS__
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   104
# undef __new
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   105
# undef HAS_WAITPID
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   106
# undef HAS_WAIT3
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   107
# undef WANT_REALPATH
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   108
# undef HAS_USLEEP
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   109
# define NO_WAITPID
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   110
# define NO_SETITIMER
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   111
# define NO_GRP_H
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   112
# define HAS_REMOVE
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   113
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   114
# ifdef __openVMS__
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   115
#  ifndef _UNISTD_H_INCLUDED_
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   116
#   include <unistd.h>
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   117
#   define _UNISTD_H_INCLUDED_
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   118
#  endif
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   119
# endif
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   120
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   121
  /*
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   122
   * req'd for additional fileInfo
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   123
   */
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   124
# incldue <rms.h> /* */
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   125
# include <fabdef.h>
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   126
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   127
  /*
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   128
   * req'd for subprocess support
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   129
   */
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   130
# include <iodef.h>
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   131
# include <ssdef.h>
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   132
# include <syidef.h>
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   133
# include <clidef.h>
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   134
# include <stsdef.h>
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   135
# include <dvidef.h>
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   136
# include <nam.h>
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   137
# include <descrip.h>
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   138
# include <lib$routines.h>
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   139
# include <starlet.h>
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   140
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   141
# define xxxUSE_SLOW_ALARM
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   142
# define USE_AST_TIMER
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   143
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   144
/* VMS variable length string */
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   145
struct Vstring {
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   146
  short length;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   147
  char body[NAM$C_MAXRSS+1];
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   148
};
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   149
2975
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
   150
/* VMS typeahead-ask struct */
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
   151
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
   152
struct typahdask {
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
   153
    short typcnt;       /* chars in buffer */
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
   154
    char firstChar;     /* first character */
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
   155
    char reserve1;      /* secret */
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
   156
    long reserve2;      /* secret */
2975
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
   157
};
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
   158
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   159
/* VMS I/O status block */
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   160
struct IOSB {
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   161
  short status, count;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   162
  long devinfo;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   163
};
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   164
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   165
/* VMS Item List 3 structure */
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   166
struct itm$list3 {
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   167
  short buflen;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   168
  short itemcode;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   169
  void *buffer;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   170
  size_t *retlen;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   171
};
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   172
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   173
/* ST/X maintained per-process information */
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   174
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   175
struct procInfo {
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   176
    long  returnStatus; 
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   177
    long  pid;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   178
    char  eventFlag;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   179
    char  finished;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   180
    struct procInfo *nextProc;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   181
};
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   182
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   183
/*
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   184
 * move this to alphaIntern.h ...
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   185
 */
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   186
# if __VMS_VER < 70000000
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   187
#  define NO_PWD
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   188
# endif
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   189
# efine NO_PWD_PASSWD
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   190
# efine NO_PWD_GECOS
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   191
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   192
#endif /* __VMS__ */
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   193
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   194
/*
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   195
 * notice: although many systems' include files
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   196
 * already block against multiple inclusion, some
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   197
 * do not. Therefore, this is done here again.
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   198
 * (it does not hurt)
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   199
 */ 
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   200
439
claus
parents: 438
diff changeset
   201
#ifdef WANT_REALPATH
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   202
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   203
# ifndef NO_SYS_PARAM_H
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   204
#  include <sys/param.h>
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   205
#  define _SYS_PARAM_H_INCLUDED_
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   206
# endif
439
claus
parents: 438
diff changeset
   207
claus
parents: 438
diff changeset
   208
# include <errno.h>
claus
parents: 438
diff changeset
   209
# define _ERRNO_H_INCLUDED_
claus
parents: 438
diff changeset
   210
claus
parents: 438
diff changeset
   211
# include <sys/stat.h>
claus
parents: 438
diff changeset
   212
# define _SYS_STAT_H_INCLUDED_
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   213
439
claus
parents: 438
diff changeset
   214
#endif /* WANT_REALPATH */
claus
parents: 438
diff changeset
   215
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   216
434
0511ecb7c818 *** empty log message ***
claus
parents: 433
diff changeset
   217
#ifdef WANT_SHM
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   218
extern int shmctl(), shmget(), shmdt();
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   219
extern char * shmat();
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   220
434
0511ecb7c818 *** empty log message ***
claus
parents: 433
diff changeset
   221
# include <sys/types.h>
437
claus
parents: 434
diff changeset
   222
# define _SYS_TYPES_H_INCLUDED_
439
claus
parents: 438
diff changeset
   223
434
0511ecb7c818 *** empty log message ***
claus
parents: 433
diff changeset
   224
# include <sys/ipc.h>
437
claus
parents: 434
diff changeset
   225
# define _SYS_IPC_H_INCLUDED_
439
claus
parents: 438
diff changeset
   226
434
0511ecb7c818 *** empty log message ***
claus
parents: 433
diff changeset
   227
# include <sys/shm.h>
437
claus
parents: 434
diff changeset
   228
# define _SYS_SHM_H_INCLUDED_
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   229
439
claus
parents: 438
diff changeset
   230
#endif /* WANT_SHM */
434
0511ecb7c818 *** empty log message ***
claus
parents: 433
diff changeset
   231
0511ecb7c818 *** empty log message ***
claus
parents: 433
diff changeset
   232
#ifdef IRIX5
0511ecb7c818 *** empty log message ***
claus
parents: 433
diff changeset
   233
# include <sys/syssgi.h>
0511ecb7c818 *** empty log message ***
claus
parents: 433
diff changeset
   234
#endif
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   235
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   236
511
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   237
#ifdef transputer
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   238
511
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   239
# define unlink(f)      ((remove(f) == 0) ? 0 : -1)
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   240
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   241
#else /* not transputer */
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   242
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   243
# ifndef _SIGNAL_H_INCLUDED_
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   244
#  include <signal.h>
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   245
#  define _SIGNAL_H_INCLUDED_
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   246
# endif
511
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   247
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   248
# ifdef SYSV
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   249
#  ifndef _SYS_TYPES_H_INCLUDED_
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   250
#   include <sys/types.h>
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   251
#   define _SYS_TYPES_H_INCLUDED_
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   252
#  endif
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   253
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   254
#  ifndef _SYS_PARAM_H_INCLUDED_
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   255
#   ifndef NO_SYS_PARAM_H
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   256
#    include <sys/param.h>
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   257
#    define _SYS_PARAM_H_INCLUDED_
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   258
#   endif
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   259
#  endif
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   260
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   261
#  ifndef _SYS_TIMES_H_INCLUDED_
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   262
#   include <sys/times.h>
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   263
#   define _SYS_TIMES_H_INCLUDED_
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   264
#  endif
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   265
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   266
#  ifndef _SYS_FILE_H_INCLUDED_
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   267
#   include <sys/file.h>
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   268
#   define _SYS_FILE_H_INCLUDED_
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   269
#  endif
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   270
511
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   271
#  if ! defined(sco3_2)
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   272
#   ifndef _UNISTD_H_INCLUDED_
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   273
#    include <unistd.h>
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   274
#    define _UNISTD_H_INCLUDED_
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   275
#   endif
511
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   276
#  endif
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   277
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   278
#  if defined(isc3_2) || defined(sco3_2)
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   279
#   ifndef _SYS_TIME_H_INCLUDED_
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   280
#    include <sys/time.h>
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   281
#    define _SYS_TIME_H_INCLUDED_
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   282
#   endif
511
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   283
#  endif
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   284
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   285
#  if !defined(isc3_2)
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   286
#   if defined(PCS) && defined(mips)
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   287
#    include "/usr/include/bsd/sys/time.h"
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   288
#    include "/usr/include/sys/time.h"
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   289
#   else
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   290
#    ifndef _TIME_H_INCLUDED_
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   291
#     include <time.h>
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   292
#     define _TIME_H_INCLUDED_
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   293
#    endif
511
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   294
#   endif
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   295
#  endif
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   296
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   297
#  if defined(isc3_2)
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   298
#   include <sys/bsdtypes.h>
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   299
#  endif
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   300
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   301
# else /* not SYSV */
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   302
802
087384994c4a even worse
Claus Gittinger <cg@exept.de>
parents: 801
diff changeset
   303
#  ifdef MSDOS_LIKE
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   304
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   305
#   ifndef _SYS_TYPES_H_INCLUDED_
2995
07f6017880ec win32 changes
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   306
#    include <sys/types.h>
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   307
#    define _SYS_TYPES_H_INCLUDED_
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   308
#   endif
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   309
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   310
#   ifndef _TIME_H_INCLUDED_
2995
07f6017880ec win32 changes
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   311
#    include <time.h>
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   312
#    define _TIME_H_INCLUDED_
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   313
#   endif
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   314
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   315
#   ifndef _SYS_TIMEB_H_INCLUDED_
2995
07f6017880ec win32 changes
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   316
#    include <sys/timeb.h>
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   317
#    define _SYS_TIMEB_H_INCLUDED_
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   318
#   endif
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   319
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   320
#  else /* not MSDOS_like */
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   321
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   322
#   ifndef _SYS_TIME_H_INCLUDED_
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   323
#    include <sys/time.h>
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   324
#    define _SYS_TIME_H_INCLUDED_
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   325
#   endif
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   326
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   327
#   ifndef _SYS_TYPES_H_INCLUDED_
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   328
#    include <sys/types.h>
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   329
#    define _SYS_TYPES_H_INCLUDED_
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   330
#   endif
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   331
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   332
#  endif /* not MSDOS */
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
   333
# endif /* not SYSV */
511
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   334
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   335
511
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   336
# ifdef aix
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   337
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   338
#  ifndef _TIME_H_INCLUDED_
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   339
#   include <time.h>
914
d00401a9450e Fix syntax error (#defined -> #define).
Stefan Vogel <sv@exept.de>
parents: 855
diff changeset
   340
#   define _TIME_H_INCLUDED_
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   341
#  endif
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   342
#  ifndef _SYS_SELECT_H_INCLUDED_
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   343
#   include <sys/select.h>
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   344
#   define _SYS_SELECT_H_INCLUDED_
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   345
#  endif
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   346
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
   347
# endif /* aix */
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
   348
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   349
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
   350
# ifndef MSDOS_LIKE
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   351
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   352
#  ifndef _PWD_H_INCLUDED_
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   353
#   include <pwd.h>
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   354
#   define _PWD_H_INCLUDED_
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   355
#  endif
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   356
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   357
#  ifndef NO_GRP_H
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   358
#   ifndef _GRP_H_INCLUDED_
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   359
#    include <grp.h>
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   360
#    define _GRP_H_INCLUDED_
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   361
#   endif
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   362
#  endif
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   363
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
   364
# endif /* not MSDOS */
511
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   365
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   366
# ifndef _SYS_STAT_H_INCLUDED_
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   367
#  include <sys/stat.h>
1616
fa734ea238f8 type & include file.h on all systems
Claus Gittinger <cg@exept.de>
parents: 1615
diff changeset
   368
#  define _SYS_STAT_H_INCLUDED_
fa734ea238f8 type & include file.h on all systems
Claus Gittinger <cg@exept.de>
parents: 1615
diff changeset
   369
# endif
fa734ea238f8 type & include file.h on all systems
Claus Gittinger <cg@exept.de>
parents: 1615
diff changeset
   370
fa734ea238f8 type & include file.h on all systems
Claus Gittinger <cg@exept.de>
parents: 1615
diff changeset
   371
# ifndef _SYS_FILE_H_INCLUDED_
1633
dc4105e87116 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1632
diff changeset
   372
#  ifndef WIN32
dc4105e87116 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1632
diff changeset
   373
#   include <sys/file.h>
dc4105e87116 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1632
diff changeset
   374
#  endif
1616
fa734ea238f8 type & include file.h on all systems
Claus Gittinger <cg@exept.de>
parents: 1615
diff changeset
   375
#  define _SYS_FILE_H_INCLUDED_
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   376
# endif
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   377
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   378
# ifndef _ERRNO_H_INCLUDED_
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   379
#  include <errno.h>
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   380
#  define _ERRNO_H_INCLUDED_
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   381
# endif
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   382
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   383
# ifndef _STDIO_H_INCLUDED_
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   384
#  include <stdio.h>
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   385
#  define _STDIO_H_INCLUDED_
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   386
# endif
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   387
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   388
# ifndef _FCNTL_H_INCLUDED_
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   389
#  include <fcntl.h>
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   390
#  define _FCNTL_H_INCLUDED_
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   391
# endif
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   392
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   393
# ifdef WIN32
2631
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
   394
#  define xxUSE_TimerProc
1632
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
   395
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
   396
#  undef INT
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
   397
#  undef Array
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
   398
#  undef Number
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
   399
#  undef Method
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
   400
#  undef Point
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
   401
#  undef Rectangle
1987
8249e9134622 win32 changes
Claus Gittinger <cg@exept.de>
parents: 1982
diff changeset
   402
#  undef Block
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   403
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   404
/* #  include <windows.h> /* */
1987
8249e9134622 win32 changes
Claus Gittinger <cg@exept.de>
parents: 1982
diff changeset
   405
#  include <stdarg.h> /* */
8249e9134622 win32 changes
Claus Gittinger <cg@exept.de>
parents: 1982
diff changeset
   406
#  include <windef.h> /* */
8249e9134622 win32 changes
Claus Gittinger <cg@exept.de>
parents: 1982
diff changeset
   407
#  include <winbase.h> /* */
8249e9134622 win32 changes
Claus Gittinger <cg@exept.de>
parents: 1982
diff changeset
   408
#  include <wingdi.h> /* */
8249e9134622 win32 changes
Claus Gittinger <cg@exept.de>
parents: 1982
diff changeset
   409
#  include <winuser.h> /* */
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   410
1632
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
   411
#  ifdef __DEF_Array
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
   412
#   define Array __DEF_Array
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
   413
#  endif
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
   414
#  ifdef __DEF_Number
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
   415
#   define Number __DEF_Number
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
   416
#  endif
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
   417
#  ifdef __DEF_Method
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
   418
#   define Method __DEF_Method
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
   419
#  endif
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
   420
#  ifdef __DEF_Point
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
   421
#   define Point __DEF_Point
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
   422
#  endif
1987
8249e9134622 win32 changes
Claus Gittinger <cg@exept.de>
parents: 1982
diff changeset
   423
#  ifdef __DEF_Block
8249e9134622 win32 changes
Claus Gittinger <cg@exept.de>
parents: 1982
diff changeset
   424
#   define Block __DEF_Block
8249e9134622 win32 changes
Claus Gittinger <cg@exept.de>
parents: 1982
diff changeset
   425
#  endif
2995
07f6017880ec win32 changes
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   426
#  define INT int
1632
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
   427
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
   428
#  define stat _stat
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   429
#  define WIN32_ERR(x)  ((x) | 0x01000000)      /* tag GetLastError codes */
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   430
						/* as opposed to Posix errors */
1632
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
   431
# endif /* WIN32 */
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   432
511
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   433
813
1f9611434418 first stuff for locale support added
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   434
# if defined(LINUX)
1f9611434418 first stuff for locale support added
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   435
#  define HAS_LOCALECONV
1f9611434418 first stuff for locale support added
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   436
# endif
1f9611434418 first stuff for locale support added
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   437
1f9611434418 first stuff for locale support added
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   438
# if defined (HAS_LOCALECONV)
1f9611434418 first stuff for locale support added
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   439
#  ifndef _LOCALE_H_INCLUDED_
1f9611434418 first stuff for locale support added
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   440
#   include <locale.h>
1f9611434418 first stuff for locale support added
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   441
#   define _LOCALE_H_INCLUDED_
1f9611434418 first stuff for locale support added
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   442
#  endif
1f9611434418 first stuff for locale support added
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   443
# endif
1f9611434418 first stuff for locale support added
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   444
511
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   445
/* 
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   446
 * posix systems should define these ... 
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   447
 * but on some (older) systems, they are not.
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   448
 */
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   449
# ifndef S_IXUSR
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   450
#  ifdef S_IEXEC
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   451
#   define S_IXUSR S_IEXEC
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   452
#   define S_IXGRP (S_IEXEC>>3)
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   453
#   define S_IXOTH (S_IEXEC>>6)
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   454
#  endif
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   455
# endif
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   456
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   457
# ifndef S_IXUSR
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   458
#  define S_IXUSR 0100
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   459
#  define S_IXGRP 0010
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   460
#  define S_IXOTH 0001
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   461
# endif
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   462
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   463
# ifndef S_IRUSR
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   464
#  define S_IRUSR 0400
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   465
#  define S_IRGRP 0040
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   466
#  define S_IROTH 0004
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   467
# endif
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   468
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   469
# ifndef S_IWUSR
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   470
#  define S_IWUSR 0200
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   471
#  define S_IWGRP 0020
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   472
#  define S_IWOTH 0002
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   473
# endif
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   474
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   475
# ifndef MAXPATHLEN
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
   476
#  ifndef MSDOS_LIKE
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   477
#   ifndef NO_SYS_PARAM_H
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   478
#    include <sys/param.h>
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   479
#   endif
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
   480
#  endif
511
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   481
#  ifndef MAXPATHLEN
813
1f9611434418 first stuff for locale support added
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   482
#   ifdef FILENAME_MAX  /* i.e. MSDOS_LIKE */
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
   483
#    define MAXPATHLEN FILENAME_MAX
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
   484
#   else
2619
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
   485
#    ifdef MAX_PATH
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
   486
#     define MAXPATHLEN MAX_PATH
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
   487
#    else
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
   488
#     define MAXPATHLEN 1024
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
   489
#    endif
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
   490
#   endif
511
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   491
#  endif
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   492
# endif
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   493
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   494
# if defined(HAS_UNAME)
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   495
#  include <sys/utsname.h>
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   496
# endif
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   497
754
0dcc8af63497 Fix enableIoInterrupts for SYSV4.
Stefan Vogel <sv@exept.de>
parents: 714
diff changeset
   498
# if defined(SYSV4)
0dcc8af63497 Fix enableIoInterrupts for SYSV4.
Stefan Vogel <sv@exept.de>
parents: 714
diff changeset
   499
#  include <stropts.h>
0dcc8af63497 Fix enableIoInterrupts for SYSV4.
Stefan Vogel <sv@exept.de>
parents: 714
diff changeset
   500
# endif
0dcc8af63497 Fix enableIoInterrupts for SYSV4.
Stefan Vogel <sv@exept.de>
parents: 714
diff changeset
   501
763
7d5e32ed435e dummy SA_xxx defs for systems which dont have them (HP & ultrix)
Claus Gittinger <cg@exept.de>
parents: 762
diff changeset
   502
/*
2073
4c2bdfc668c9 NEXT changes (again)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
   503
 * NeXT has no pid_t
2107
9987b837fe12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2098
diff changeset
   504
 * and no sigemptyset
2073
4c2bdfc668c9 NEXT changes (again)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
   505
 */
2156
56115af62ce5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
   506
# ifdef NEXT3
2073
4c2bdfc668c9 NEXT changes (again)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
   507
   typedef int pid_t;
2107
9987b837fe12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2098
diff changeset
   508
#  define sigemptyset(set)      ((*(set) = 0L), 0)
2156
56115af62ce5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
   509
#  define HAS_GETDOMAINNAME
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
   510
#  define NO_WAITPID
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
   511
# endif
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
   512
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
   513
# ifdef sunos
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
   514
#  undef NO_WAITPID
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
   515
#  undef HAS_WAITPID
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
   516
#  define HAS_WAIT3
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
   517
#  define HAS_SIGACTION
2073
4c2bdfc668c9 NEXT changes (again)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
   518
# endif
4c2bdfc668c9 NEXT changes (again)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
   519
2847
6ac46b957f3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2846
diff changeset
   520
# ifdef _AIX
6ac46b957f3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2846
diff changeset
   521
#  undef HAS_WAIT3
6ac46b957f3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2846
diff changeset
   522
# endif
6ac46b957f3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2846
diff changeset
   523
2073
4c2bdfc668c9 NEXT changes (again)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
   524
/*
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   525
 * some (BSD ?) have no timezone global,
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   526
 * but provide the info in struct timezone.
2073
4c2bdfc668c9 NEXT changes (again)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
   527
 */
4c2bdfc668c9 NEXT changes (again)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
   528
# if defined(ultrix) || defined(sunos) || defined(NEXT)
4c2bdfc668c9 NEXT changes (again)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
   529
#  define HAS_NO_TIMEZONE
4c2bdfc668c9 NEXT changes (again)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
   530
# endif
4c2bdfc668c9 NEXT changes (again)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
   531
4c2bdfc668c9 NEXT changes (again)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
   532
/*
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
   533
 * sigaction dummies (you won't believe these call themself ``POSIX'' systems ...)
763
7d5e32ed435e dummy SA_xxx defs for systems which dont have them (HP & ultrix)
Claus Gittinger <cg@exept.de>
parents: 762
diff changeset
   534
 */
7d5e32ed435e dummy SA_xxx defs for systems which dont have them (HP & ultrix)
Claus Gittinger <cg@exept.de>
parents: 762
diff changeset
   535
# ifndef SA_RESTART
813
1f9611434418 first stuff for locale support added
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   536
#  define SA_RESTART    0
763
7d5e32ed435e dummy SA_xxx defs for systems which dont have them (HP & ultrix)
Claus Gittinger <cg@exept.de>
parents: 762
diff changeset
   537
# endif
7d5e32ed435e dummy SA_xxx defs for systems which dont have them (HP & ultrix)
Claus Gittinger <cg@exept.de>
parents: 762
diff changeset
   538
# ifndef SA_SIGINFO
813
1f9611434418 first stuff for locale support added
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   539
#  define SA_SIGINFO    0
763
7d5e32ed435e dummy SA_xxx defs for systems which dont have them (HP & ultrix)
Claus Gittinger <cg@exept.de>
parents: 762
diff changeset
   540
# endif
7d5e32ed435e dummy SA_xxx defs for systems which dont have them (HP & ultrix)
Claus Gittinger <cg@exept.de>
parents: 762
diff changeset
   541
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
   542
# if defined(HAS_WAITPID) || defined(HAS_WAIT3)
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
   543
#  include <sys/wait.h>
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
   544
# endif
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
   545
1433
8b2eacaea59c Getdomainname for Unixware.
Stefan Vogel <sv@exept.de>
parents: 1422
diff changeset
   546
# if defined(HAS_SYSINFO)
8b2eacaea59c Getdomainname for Unixware.
Stefan Vogel <sv@exept.de>
parents: 1422
diff changeset
   547
#  include <sys/systeminfo.h>
8b2eacaea59c Getdomainname for Unixware.
Stefan Vogel <sv@exept.de>
parents: 1422
diff changeset
   548
# endif
8b2eacaea59c Getdomainname for Unixware.
Stefan Vogel <sv@exept.de>
parents: 1422
diff changeset
   549
1615
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
   550
#endif /* not transputer */
511
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   551
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   552
/*
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   553
 * on some systems errno is a macro ... check for it here
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   554
 */
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   555
#ifndef errno
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   556
 extern errno;
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   557
#endif
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   558
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   559
/*
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   560
 * some (old ?) systems do not define this ...
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   561
 */
675
f3461db7a0ee avoid a warning
Claus Gittinger <cg@exept.de>
parents: 674
diff changeset
   562
#if !defined(R_OK) && !defined(_AIX)
511
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   563
# define R_OK    4       /* Test for Read permission */ 
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   564
# define W_OK    2       /* Test for Write permission */
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   565
# define X_OK    1       /* Test for eXecute permission */
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   566
# define F_OK    0       /* Test for existence of File */
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   567
#endif
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   568
832
70e8b7fc357e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
   569
#ifdef WIN32
70e8b7fc357e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
   570
# define SIGHANDLER_ARG int
70e8b7fc357e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
   571
#else
70e8b7fc357e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
   572
# define SIGHANDLER_ARG
70e8b7fc357e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
   573
#endif
70e8b7fc357e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 831
diff changeset
   574
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   575
#ifdef sunos
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   576
# define NO_WAITPID
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   577
#endif
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   578
#ifdef NEXT
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   579
# define NO_WAITPID
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   580
#endif
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   581
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   582
#ifdef MSDOS_LIKE
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   583
#define _HANDLEVal(o)        (HANDLE)(__MKCP(o))
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   584
#endif
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
   585
2797
971e74335490 alpha changes
Claus Gittinger <cg@exept.de>
parents: 2795
diff changeset
   586
/*
971e74335490 alpha changes
Claus Gittinger <cg@exept.de>
parents: 2795
diff changeset
   587
 * not all systems have time_t and off_t
971e74335490 alpha changes
Claus Gittinger <cg@exept.de>
parents: 2795
diff changeset
   588
 * explicit add of those we know to have ...
971e74335490 alpha changes
Claus Gittinger <cg@exept.de>
parents: 2795
diff changeset
   589
 */
971e74335490 alpha changes
Claus Gittinger <cg@exept.de>
parents: 2795
diff changeset
   590
#ifdef __osf__
2832
3b9900929fb3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2797
diff changeset
   591
# define TIME_T time_t
3b9900929fb3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2797
diff changeset
   592
# define OFF_T  off_t
2797
971e74335490 alpha changes
Claus Gittinger <cg@exept.de>
parents: 2795
diff changeset
   593
#endif
971e74335490 alpha changes
Claus Gittinger <cg@exept.de>
parents: 2795
diff changeset
   594
971e74335490 alpha changes
Claus Gittinger <cg@exept.de>
parents: 2795
diff changeset
   595
#ifndef TIME_T
2832
3b9900929fb3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2797
diff changeset
   596
# define TIME_T long
2797
971e74335490 alpha changes
Claus Gittinger <cg@exept.de>
parents: 2795
diff changeset
   597
#endif
971e74335490 alpha changes
Claus Gittinger <cg@exept.de>
parents: 2795
diff changeset
   598
#ifndef OFF_T
2832
3b9900929fb3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2797
diff changeset
   599
# define OFF_T  long
2797
971e74335490 alpha changes
Claus Gittinger <cg@exept.de>
parents: 2795
diff changeset
   600
#endif
971e74335490 alpha changes
Claus Gittinger <cg@exept.de>
parents: 2795
diff changeset
   601
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   602
/*
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   603
 * where is the timezone info ?
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   604
 */
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   605
#if defined(HAS_NO_TIMEZONE)
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   606
# if defined(HAS_NO_TM_GMTOFF)
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   607
#  define TIMEZONE(tmPtr)       0
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   608
# else
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   609
#  define TIMEZONE(tmPtr)       ((tmPtr)->tm_gmtoff)
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   610
# endif
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   611
#else
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   612
# ifdef MSDOS_LIKE
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   613
#   define TIMEZONE(tmPtr)      0
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   614
# else
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   615
#  define TIMEZONE(tmPtr)       timezone
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   616
# endif
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   617
#endif
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   618
437
claus
parents: 434
diff changeset
   619
%}
claus
parents: 434
diff changeset
   620
! !
claus
parents: 434
diff changeset
   621
claus
parents: 434
diff changeset
   622
!OperatingSystem primitiveFunctions!
claus
parents: 434
diff changeset
   623
%{
claus
parents: 434
diff changeset
   624
claus
parents: 434
diff changeset
   625
/*
claus
parents: 434
diff changeset
   626
 * some systems' system() is broken in that it does not correctly 
claus
parents: 434
diff changeset
   627
 * handle EINTR and returns failure even though it actually succeeded. 
claus
parents: 434
diff changeset
   628
 * (LINUX is one of them)
claus
parents: 434
diff changeset
   629
 * Here is a fixed version. If you encounter EINTR returns from
claus
parents: 434
diff changeset
   630
 * OperatingSystem>>executeCommand, you ought to define WANT_SYSTEM
claus
parents: 434
diff changeset
   631
 * in the xxxIntern.h file to get this fixed version.
claus
parents: 434
diff changeset
   632
 *
claus
parents: 434
diff changeset
   633
 * As an added BONUS, this system() enables interrupts while waiting
claus
parents: 434
diff changeset
   634
 * for the child which enables other threads to continue.
507
a7780fc27ee9 mad system interuptable (needs WANT_SYSTEM to be defined in xxxIntern.h)
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
   635
 * (i.e. it is RT safe)
437
claus
parents: 434
diff changeset
   636
 */
511
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   637
433
f74d003548dc system-fix
claus
parents: 424
diff changeset
   638
#if defined(WANT_SYSTEM)
f74d003548dc system-fix
claus
parents: 424
diff changeset
   639
434
0511ecb7c818 *** empty log message ***
claus
parents: 433
diff changeset
   640
/* # define DPRINTF(x)     printf x */
0511ecb7c818 *** empty log message ***
claus
parents: 433
diff changeset
   641
# define DPRINTF(x)     /* nothing */
433
f74d003548dc system-fix
claus
parents: 424
diff changeset
   642
437
claus
parents: 434
diff changeset
   643
# ifndef _STDDEF_H_INCLUDED_
claus
parents: 434
diff changeset
   644
#  include <stddef.h>
claus
parents: 434
diff changeset
   645
#  define _STDDEF_H_INCLUDED_
claus
parents: 434
diff changeset
   646
# endif
claus
parents: 434
diff changeset
   647
claus
parents: 434
diff changeset
   648
# ifndef _STDLIB_H_INCLUDED_
claus
parents: 434
diff changeset
   649
#  include <stdlib.h>
claus
parents: 434
diff changeset
   650
#  define _STDLIB_H_INCLUDED_
claus
parents: 434
diff changeset
   651
# endif
claus
parents: 434
diff changeset
   652
claus
parents: 434
diff changeset
   653
# ifndef _UNISTD_H_INCLUDED_
claus
parents: 434
diff changeset
   654
#  include <unistd.h>
claus
parents: 434
diff changeset
   655
#  define _UNISTD_H_INCLUDED_
claus
parents: 434
diff changeset
   656
# endif
claus
parents: 434
diff changeset
   657
claus
parents: 434
diff changeset
   658
# ifndef _SYS_WAIT_H_INCLUDED
claus
parents: 434
diff changeset
   659
#  include <sys/wait.h>
claus
parents: 434
diff changeset
   660
#  define _SYS_WAIT_H_INCLUDED
claus
parents: 434
diff changeset
   661
# endif
claus
parents: 434
diff changeset
   662
claus
parents: 434
diff changeset
   663
# ifndef _SIGNAL_H_INCLUDED_
claus
parents: 434
diff changeset
   664
#  include <signal.h>
claus
parents: 434
diff changeset
   665
#  define _SIGNAL_H_INCLUDED_
claus
parents: 434
diff changeset
   666
# endif
claus
parents: 434
diff changeset
   667
claus
parents: 434
diff changeset
   668
# ifndef _SYS_TYPES_H_INCLUDED_
claus
parents: 434
diff changeset
   669
#  include <sys/types.h>
claus
parents: 434
diff changeset
   670
#  define _SYS_TYPES_H_INCLUDED_
claus
parents: 434
diff changeset
   671
# endif
433
f74d003548dc system-fix
claus
parents: 424
diff changeset
   672
511
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   673
# if (!defined(HAVE_GNU_LD) && !defined (__ELF__)) || !defined(LINUX)
433
f74d003548dc system-fix
claus
parents: 424
diff changeset
   674
#  define       __environ       environ
512
f440411a55e4 no redef warnings on LINUX
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   675
#  if !defined(LINUX)
530
07d0bce293c9 uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   676
#   define      __sigemptyset   sigemptyset
07d0bce293c9 uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   677
#   define      __sigaction     sigaction
07d0bce293c9 uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   678
#   define      __sigaddset     sigaddset
07d0bce293c9 uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   679
#   define      __sigprocmask   sigprocmask
07d0bce293c9 uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   680
#   define      __execve        execve
07d0bce293c9 uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   681
#   define      __wait          wait
07d0bce293c9 uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   682
#   define      __waitpid       waitpid
674
fba47329ac9d fixed startProcess
Claus Gittinger <cg@exept.de>
parents: 670
diff changeset
   683
#   if defined(HAS_VFORK)
530
07d0bce293c9 uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   684
#    define     FORK            vfork
514
81fa80a953e2 system() now interruptable with ultrix
Claus Gittinger <cg@exept.de>
parents: 513
diff changeset
   685
#   else
530
07d0bce293c9 uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
   686
#    define     FORK            fork
514
81fa80a953e2 system() now interruptable with ultrix
Claus Gittinger <cg@exept.de>
parents: 513
diff changeset
   687
#   endif
512
f440411a55e4 no redef warnings on LINUX
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
   688
#  endif /* ! LINUX */
511
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   689
   extern char **environ;
433
f74d003548dc system-fix
claus
parents: 424
diff changeset
   690
# endif
f74d003548dc system-fix
claus
parents: 424
diff changeset
   691
f74d003548dc system-fix
claus
parents: 424
diff changeset
   692
# define        SHELL_PATH      "/bin/sh"       /* Path of the shell.  */
f74d003548dc system-fix
claus
parents: 424
diff changeset
   693
# define        SHELL_NAME      "sh"            /* Name to give it.  */
f74d003548dc system-fix
claus
parents: 424
diff changeset
   694
f74d003548dc system-fix
claus
parents: 424
diff changeset
   695
# ifndef        FORK
f74d003548dc system-fix
claus
parents: 424
diff changeset
   696
#  define       FORK    __fork
f74d003548dc system-fix
claus
parents: 424
diff changeset
   697
# endif
f74d003548dc system-fix
claus
parents: 424
diff changeset
   698
f74d003548dc system-fix
claus
parents: 424
diff changeset
   699
# ifndef CONST
f74d003548dc system-fix
claus
parents: 424
diff changeset
   700
#  ifdef __GNUC__
f74d003548dc system-fix
claus
parents: 424
diff changeset
   701
#   define CONST const
f74d003548dc system-fix
claus
parents: 424
diff changeset
   702
#  else
f74d003548dc system-fix
claus
parents: 424
diff changeset
   703
#   define CONST /* nothing */
f74d003548dc system-fix
claus
parents: 424
diff changeset
   704
#  endif
f74d003548dc system-fix
claus
parents: 424
diff changeset
   705
# endif
f74d003548dc system-fix
claus
parents: 424
diff changeset
   706
670
4d6d0c031711 startProcess: / killProcess: added
Claus Gittinger <cg@exept.de>
parents: 640
diff changeset
   707
static int
511
7626c5474c7f interruptable system() for IRIX5
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   708
mySystem(line)
433
f74d003548dc system-fix
claus
parents: 424
diff changeset
   709
    register CONST char *line;
f74d003548dc system-fix
claus
parents: 424
diff changeset
   710
{
f74d003548dc system-fix
claus
parents: 424
diff changeset
   711
    int status, save;
f74d003548dc system-fix
claus
parents: 424
diff changeset
   712
    pid_t pid;
f74d003548dc system-fix
claus
parents: 424
diff changeset
   713
    struct sigaction sa, intr, quit;
f74d003548dc system-fix
claus
parents: 424
diff changeset
   714
    sigset_t block, omask;
f74d003548dc system-fix
claus
parents: 424
diff changeset
   715
f74d003548dc system-fix
claus
parents: 424
diff changeset
   716
    if (line == NULL)
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   717
	return -1;
433
f74d003548dc system-fix
claus
parents: 424
diff changeset
   718
f74d003548dc system-fix
claus
parents: 424
diff changeset
   719
    sa.sa_handler = SIG_IGN;
f74d003548dc system-fix
claus
parents: 424
diff changeset
   720
    sa.sa_flags = 0;
f74d003548dc system-fix
claus
parents: 424
diff changeset
   721
    __sigemptyset (&sa.sa_mask);
f74d003548dc system-fix
claus
parents: 424
diff changeset
   722
f74d003548dc system-fix
claus
parents: 424
diff changeset
   723
    if (__sigaction (SIGINT, &sa, &intr) < 0) {
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   724
	DPRINTF(("1: errno=%d\n", errno));
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   725
	return -1;
433
f74d003548dc system-fix
claus
parents: 424
diff changeset
   726
    }
f74d003548dc system-fix
claus
parents: 424
diff changeset
   727
    if (__sigaction (SIGQUIT, &sa, &quit) < 0) {
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   728
	save = errno;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   729
	(void) __sigaction (SIGINT, &intr, (struct sigaction *) NULL);
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   730
	errno = save;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   731
	DPRINTF(("2: errno=%d\n", errno));
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   732
	return -1;
433
f74d003548dc system-fix
claus
parents: 424
diff changeset
   733
    }
f74d003548dc system-fix
claus
parents: 424
diff changeset
   734
f74d003548dc system-fix
claus
parents: 424
diff changeset
   735
    __sigemptyset (&block);
f74d003548dc system-fix
claus
parents: 424
diff changeset
   736
    __sigaddset (&block, SIGCHLD);
f74d003548dc system-fix
claus
parents: 424
diff changeset
   737
    save = errno;
f74d003548dc system-fix
claus
parents: 424
diff changeset
   738
    if (__sigprocmask(SIG_BLOCK, &block, &omask) < 0) {
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   739
	if (errno == ENOSYS)
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   740
	    errno = save;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   741
	else {
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   742
	    save = errno;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   743
	    (void) __sigaction(SIGINT, &intr, (struct sigaction *) NULL);
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
   744
	    (void) __sigaction (SIGQUIT, &quit, (struct sigaction *) NULL);
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   745
	    errno = save;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   746
	    DPRINTF(("3: errno=%d\n", errno));
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   747
	    return -1;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   748
	}
433
f74d003548dc system-fix
claus
parents: 424
diff changeset
   749
    }
f74d003548dc system-fix
claus
parents: 424
diff changeset
   750
f74d003548dc system-fix
claus
parents: 424
diff changeset
   751
    pid = FORK ();
f74d003548dc system-fix
claus
parents: 424
diff changeset
   752
    if (pid == (pid_t) 0) {
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   753
	/* Child side.  */
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   754
	CONST char *new_argv[4];
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   755
	new_argv[0] = SHELL_NAME;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   756
	new_argv[1] = "-c";
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   757
	new_argv[2] = line;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   758
	new_argv[3] = NULL;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   759
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   760
	/* Restore the signals.  */
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   761
	(void) __sigaction (SIGINT, &intr, (struct sigaction *) NULL);
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   762
	(void) __sigaction (SIGQUIT, &quit, (struct sigaction *) NULL);
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   763
	(void) __sigprocmask (SIG_SETMASK, &omask, (sigset_t *) NULL);
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   764
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   765
	/* Exec the shell.  */
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   766
	(void) __execve (SHELL_PATH, (char *CONST *) new_argv, __environ);
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   767
	_exit (127);
433
f74d003548dc system-fix
claus
parents: 424
diff changeset
   768
    } else {
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   769
	if (pid < (pid_t) 0) {
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   770
	    /* The fork failed.  */
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   771
	    DPRINTF(("4: errno=%d\n", errno));
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   772
	    status = -1;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   773
	} else {
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   774
	    /* Parent side.  */
433
f74d003548dc system-fix
claus
parents: 424
diff changeset
   775
#ifdef  NO_WAITPID
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   776
	    pid_t child;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   777
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   778
	    do {
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   779
		__BEGIN_INTERRUPTABLE__
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   780
		child = __wait (&status);
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   781
		__END_INTERRUPTABLE__
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   782
		if (child < 0 && errno != EINTR) {
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   783
		    DPRINTF(("5: errno=%d\n", errno));
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   784
		    status = -1;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   785
		    break;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   786
		}
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   787
	    } while (child != pid);
433
f74d003548dc system-fix
claus
parents: 424
diff changeset
   788
#else
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   789
	    pid_t child;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   790
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   791
	    /* claus: the original did not care for EINTR here ... */
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   792
	    do {
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   793
		__BEGIN_INTERRUPTABLE__
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   794
		child = __waitpid (pid, &status, 0);
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   795
		__END_INTERRUPTABLE__
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   796
	    } while ((child != pid) && (errno == EINTR));
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   797
	    if (child != pid) {
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   798
		DPRINTF(("6: errno=%d\n", errno));
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   799
		status = -1;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   800
	    }
433
f74d003548dc system-fix
claus
parents: 424
diff changeset
   801
#endif /* NO_WAITPID */
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   802
	}
433
f74d003548dc system-fix
claus
parents: 424
diff changeset
   803
    }
f74d003548dc system-fix
claus
parents: 424
diff changeset
   804
    save = errno;
f74d003548dc system-fix
claus
parents: 424
diff changeset
   805
    if ((__sigaction (SIGINT, &intr, (struct sigaction *) NULL)
f74d003548dc system-fix
claus
parents: 424
diff changeset
   806
     | __sigaction (SIGQUIT, &quit, (struct sigaction *) NULL)
f74d003548dc system-fix
claus
parents: 424
diff changeset
   807
     | __sigprocmask (SIG_SETMASK, &omask, (sigset_t *) NULL)) != 0) {
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   808
	if (errno == ENOSYS) {
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   809
	    errno = save;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   810
	} else {
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   811
	    status = -1;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   812
	    DPRINTF(("7: errno=%d\n", errno));
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   813
	}
433
f74d003548dc system-fix
claus
parents: 424
diff changeset
   814
    }
f74d003548dc system-fix
claus
parents: 424
diff changeset
   815
f74d003548dc system-fix
claus
parents: 424
diff changeset
   816
    return status;
f74d003548dc system-fix
claus
parents: 424
diff changeset
   817
}
1441
91284e90f42a sunos has no __wait
Claus Gittinger <cg@exept.de>
parents: 1433
diff changeset
   818
#else
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
   819
# define __wait wait
433
f74d003548dc system-fix
claus
parents: 424
diff changeset
   820
#endif /* WANT_SYSTEM */
f74d003548dc system-fix
claus
parents: 424
diff changeset
   821
670
4d6d0c031711 startProcess: / killProcess: added
Claus Gittinger <cg@exept.de>
parents: 640
diff changeset
   822
433
f74d003548dc system-fix
claus
parents: 424
diff changeset
   823
/*
f74d003548dc system-fix
claus
parents: 424
diff changeset
   824
 * some systems do not have realpath();
f74d003548dc system-fix
claus
parents: 424
diff changeset
   825
 * the alternative of reading from a 'pwp'-pipe
f74d003548dc system-fix
claus
parents: 424
diff changeset
   826
 * is way too slow. Here is a realpath for the rest of us.
440
claus
parents: 439
diff changeset
   827
 * define WANT_REALPATH in the xxxIntern-file to get it.
433
f74d003548dc system-fix
claus
parents: 424
diff changeset
   828
 */
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   829
440
claus
parents: 439
diff changeset
   830
#if defined(HAS_REALPATH)
claus
parents: 439
diff changeset
   831
# undef WANT_REALPATH
claus
parents: 439
diff changeset
   832
#endif
claus
parents: 439
diff changeset
   833
#if !defined(HAS_GETWD) && !defined(HAS_GETCWD)
claus
parents: 439
diff changeset
   834
# undef WANT_REALPATH
claus
parents: 439
diff changeset
   835
#endif
claus
parents: 439
diff changeset
   836
claus
parents: 439
diff changeset
   837
#if defined(WANT_REALPATH)
406
claus
parents: 384
diff changeset
   838
claus
parents: 384
diff changeset
   839
# ifndef NULL
claus
parents: 384
diff changeset
   840
#  define NULL (char *)0
claus
parents: 384
diff changeset
   841
# endif
claus
parents: 384
diff changeset
   842
439
claus
parents: 438
diff changeset
   843
# define MAX_READLINKS 32
claus
parents: 438
diff changeset
   844
claus
parents: 438
diff changeset
   845
# ifndef MAXPATHLEN
claus
parents: 438
diff changeset
   846
#  define MAXPATHLEN     1024
claus
parents: 438
diff changeset
   847
# endif
406
claus
parents: 384
diff changeset
   848
claus
parents: 384
diff changeset
   849
static
claus
parents: 384
diff changeset
   850
char *realpath(path, resolved_path)
claus
parents: 384
diff changeset
   851
char *path;
claus
parents: 384
diff changeset
   852
char resolved_path [];
claus
parents: 384
diff changeset
   853
{
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   854
	char copy_path[MAXPATHLEN];
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   855
	char link_path[MAXPATHLEN];
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   856
	char *new_path = resolved_path;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   857
	char *max_path;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   858
	int readlinks = 0;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   859
	int n;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   860
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   861
	/* Make a copy of the source path since we may need to modify it. */
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   862
	strcpy(copy_path, path);
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   863
	path = copy_path;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   864
	max_path = copy_path + MAXPATHLEN - 2;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   865
	/* If it's a relative pathname use getwd for starters. */
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   866
	if (*path != '/') {
406
claus
parents: 384
diff changeset
   867
#ifdef HAS_GETCWD
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   868
		new_path = getcwd(new_path, MAXPATHLEN - 1);
406
claus
parents: 384
diff changeset
   869
#else
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   870
		new_path = getwd(new_path);
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   871
#endif
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   872
		if (new_path == NULL) 
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   873
		    return(NULL);
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   874
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   875
		new_path += strlen(new_path);
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   876
		if (new_path[-1] != '/')
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   877
			*new_path++ = '/';
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   878
	}
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   879
	else {
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   880
		*new_path++ = '/';
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   881
		path++;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   882
	}
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   883
	/* Expand each slash-separated pathname component. */
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   884
	while (*path != '\0') {
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   885
		/* Ignore stray "/". */
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   886
		if (*path == '/') {
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   887
			path++;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   888
			continue;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   889
		}
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   890
		if (*path == '.') {
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   891
			/* Ignore ".". */
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   892
			if (path[1] == '\0' || path[1] == '/') {
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   893
				path++;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   894
				continue;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   895
			}
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   896
			if (path[1] == '.') {
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   897
				if (path[2] == '\0' || path[2] == '/') {
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   898
					path += 2;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   899
					/* Ignore ".." at root. */
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   900
					if (new_path == resolved_path + 1)
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   901
						continue;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   902
					/* Handle ".." by backing up. */
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   903
					while ((--new_path)[-1] != '/')
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   904
						;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   905
					continue;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   906
				}
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   907
			}
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   908
		}
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   909
		/* Safely copy the next pathname component. */
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   910
		while (*path != '\0' && *path != '/') {
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   911
			if (path > max_path) {
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   912
				errno = ENAMETOOLONG;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   913
				return NULL;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   914
			}
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   915
			*new_path++ = *path++;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   916
		}
406
claus
parents: 384
diff changeset
   917
#ifdef S_IFLNK
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   918
		/* Protect against infinite loops. */
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   919
		if (readlinks++ > MAX_READLINKS) {
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   920
			errno = ELOOP;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   921
			return NULL;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   922
		}
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   923
		/* See if latest pathname component is a symlink. */
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   924
		*new_path = '\0';
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   925
		n = readlink(resolved_path, link_path, MAXPATHLEN - 1);
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   926
		if (n < 0) {
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   927
			/* EINVAL means the file exists but isn't a symlink. */
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   928
			if (errno != EINVAL)
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   929
				return NULL;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   930
		}
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   931
		else {
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   932
			/* Note: readlink doesn't add the null byte. */
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   933
			link_path[n] = '\0';
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   934
			if (*link_path == '/')
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   935
				/* Start over for an absolute symlink. */
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   936
				new_path = resolved_path;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   937
			else
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   938
				/* Otherwise back up over this component. */
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   939
				while (*(--new_path) != '/')
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   940
					;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   941
			/* Safe sex check. */
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   942
			if (strlen(path) + n >= MAXPATHLEN) {
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   943
				errno = ENAMETOOLONG;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   944
				return NULL;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   945
			}
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   946
			/* Insert symlink contents into path. */
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   947
			strcat(link_path, path);
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   948
			strcpy(copy_path, link_path);
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   949
			path = copy_path;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   950
		}
406
claus
parents: 384
diff changeset
   951
#endif /* S_IFLNK */
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   952
		*new_path++ = '/';
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   953
	}
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   954
	/* Delete trailing slash but don't whomp a lone slash. */
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   955
	if (new_path != resolved_path + 1 && new_path[-1] == '/')
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   956
		new_path--;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   957
	/* Make sure it's null terminated. */
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   958
	*new_path = '\0';
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
   959
	return resolved_path;
406
claus
parents: 384
diff changeset
   960
}
claus
parents: 384
diff changeset
   961
# define HAS_REALPATH
claus
parents: 384
diff changeset
   962
#endif /* WANT_REALPATH && not HAS_REALPATH */
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   963
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   964
#ifdef __VMS__
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   965
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   966
/* #define TRACE_STAT_CALLS /* */
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   967
/* #define TRACE_ACCESS_CALLS /* */
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   968
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   969
/*
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   970
 * a stat which retries with appended '.DIR' in case of
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   971
 * failure.
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   972
 * This allows to stat a directory.
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   973
 */
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   974
int
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   975
__vms_stat__(path, buffP)
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   976
    char *path;
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   977
    struct stat *buffP;
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   978
{
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   979
	int ret;
2932
427725621da0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2930
diff changeset
   980
	int retry = 0;
2949
6993ad758a9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   981
	char t[MAXPATHLEN+1+5+2];
6993ad758a9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   982
6993ad758a9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   983
# ifdef TRACE_STAT_CALLS
6993ad758a9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   984
	printf("===> stat('%s')\n", path);
6993ad758a9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   985
# endif
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   986
	do {
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
   987
	    ret = stat(path, buffP);
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
   988
	} while ((ret < 0) && (errno == EINTR));
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   989
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   990
	if (ret < 0) {
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   991
	    /*
2949
6993ad758a9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   992
	     * try with appended ';0';
6993ad758a9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   993
	     * but only, if it has no version
6993ad758a9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   994
	     */
6993ad758a9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   995
	    if (strchr(path, ';') == NULL) {
6993ad758a9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   996
		strncpy(t, path, MAXPATHLEN);
6993ad758a9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   997
		t[MAXPATHLEN] = '\0';
6993ad758a9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   998
		strcat(t, ";0");
6993ad758a9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   999
# ifdef TRACE_STAT_CALLS
6993ad758a9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
  1000
		printf("===> stat('%s') - retry\n", t);
6993ad758a9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
  1001
# endif
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1002
		do {
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1003
		    ret = stat(t, buffP);
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1004
		} while ((ret < 0) && (errno == EINTR));
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1005
		if (ret >= 0) 
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1006
		    return ret;
2949
6993ad758a9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
  1007
	    }
6993ad758a9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
  1008
6993ad758a9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
  1009
	    /*
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1010
	     * try with appended '.DIR';
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1011
	     * but only, if it has no extension.
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1012
	     */
2939
b7cebf237308 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2937
diff changeset
  1013
	    if (strchr(path, '.') == NULL) {
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1014
		strncpy(t, path, MAXPATHLEN);
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1015
		t[MAXPATHLEN] = '\0';
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1016
		strcat(t, ".DIR;0");
2932
427725621da0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2930
diff changeset
  1017
		retry = 1;
427725621da0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2930
diff changeset
  1018
	    } else {
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1019
		/*
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1020
		 * try with appended 'DIR';
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1021
		 * but only, if it ends with '.'.
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1022
		 */
2932
427725621da0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2930
diff changeset
  1023
		if (path[strlen(path)-1] == '.') {
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1024
		    strncpy(t, path, MAXPATHLEN);
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1025
		    t[MAXPATHLEN] = '\0';
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1026
		    strcat(t, "DIR;0");
2932
427725621da0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2930
diff changeset
  1027
		    retry = 1;
427725621da0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2930
diff changeset
  1028
		}
427725621da0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2930
diff changeset
  1029
	    }
2949
6993ad758a9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
  1030
2932
427725621da0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2930
diff changeset
  1031
	    if (retry) {
2949
6993ad758a9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
  1032
# ifdef TRACE_STAT_CALLS
6993ad758a9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
  1033
		printf("===> stat('%s') - retry\n", t);
6993ad758a9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
  1034
# endif
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1035
		do {
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1036
		    ret = stat(t, buffP);
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1037
		} while ((ret < 0) && (errno == EINTR));
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1038
	    }
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1039
	}
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1040
	return ret;
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1041
}
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1042
# define stat(__path__, __buffP__)      __vms_stat__(__path__, __buffP__)
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1043
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1044
/*
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1045
 * same for access
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1046
 */
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1047
int 
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1048
__vms_access__(path, mode)
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1049
    char *path;
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1050
    int mode;
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1051
{
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1052
	int ret;
2932
427725621da0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2930
diff changeset
  1053
	int retry = 0;
427725621da0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2930
diff changeset
  1054
	char t[MAXPATHLEN+1+5];
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1055
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1056
	do {
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1057
	    ret = access(path, mode);
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1058
	} while ((ret < 0) && (errno == EINTR));
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1059
	if (ret < 0) {
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1060
	    /*
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1061
	     * try with appended '.DIR';
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1062
	     * but only, if it has no extension.
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1063
	     */
2939
b7cebf237308 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2937
diff changeset
  1064
	    if (strchr(path, '.') == NULL) {
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1065
		strncpy(t, path, MAXPATHLEN);
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1066
		t[MAXPATHLEN] = '\0';
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1067
		strcat(t, ".DIR");
2932
427725621da0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2930
diff changeset
  1068
		retry = 1;
427725621da0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2930
diff changeset
  1069
	    } else {
427725621da0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2930
diff changeset
  1070
		if (path[strlen(path)-1] == '.') {
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1071
		    strncpy(t, path, MAXPATHLEN);
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1072
		    t[MAXPATHLEN] = '\0';
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1073
		    strcat(t, "DIR");
2932
427725621da0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2930
diff changeset
  1074
		    retry = 1;
427725621da0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2930
diff changeset
  1075
		}
427725621da0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2930
diff changeset
  1076
	    }
427725621da0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2930
diff changeset
  1077
	    if (retry) {
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1078
		do {
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1079
		    ret = access(t, mode);
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1080
		} while ((ret < 0) && (errno == EINTR));
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1081
	    }
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1082
	}
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1083
	return ret;
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1084
}
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1085
# define access(__path__, __mode__)     __vms_access__(__path__, __mode__)
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1086
2973
c0c37395988a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  1087
/* #define WAITDEBUG /* */
c0c37395988a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  1088
/* #define PROCESSDEBUG /* */
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1089
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1090
void
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1091
__vms_ASTChildWithInfo(pInfo) 
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1092
    struct procInfo *pInfo;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1093
{
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1094
#ifdef WAITDEBUG
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1095
	printf("__vms_ASTChildWithInfo pI=%x\n", pInfo);
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1096
#endif
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1097
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1098
	pInfo->finished = 1;
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1099
	__vmsASTChild();        /* this signals an ST/X interrupt */
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1100
}
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1101
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1102
int
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1103
__vms_waitPid(pidToWait, pStatus, pPid)
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1104
    int pidToWait;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1105
    long *pStatus, *pPid;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1106
{
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1107
    extern struct procInfo *procInfoHead, *procInfoFree;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1108
    struct procInfo *pInfo, *prevInfo;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1109
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1110
    prevInfo = 0;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1111
#ifdef WAITDEBUG
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1112
    printf("__vms_waitPid ...\r\n", pInfo);
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1113
#endif
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1114
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1115
    for (pInfo = procInfoHead; pInfo; pInfo = pInfo->nextProc) {
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1116
#ifdef WAITDEBUG
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1117
	printf("__vms_waitPid pI=%x\r\n", pInfo);
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1118
#endif
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1119
	if (pInfo->finished) {
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1120
#ifdef WAITDEBUG
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1121
	    printf("  finished\n");
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1122
#endif
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1123
	    if ((pidToWait == -1)
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1124
	     || (pInfo->pid == pidToWait)) {
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1125
#ifdef WAITDEBUG
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1126
		printf("  pid is %d\n", pInfo->pid);
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1127
#endif
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1128
		if ((pInfo->returnStatus & STS$M_SUCCESS) != STS$M_SUCCESS)
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1129
		    *pStatus = pInfo->returnStatus;
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1130
		else
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1131
		    *pStatus = 0;
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1132
#ifdef WAITDEBUG
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1133
		printf("  status is %d (returning %d)\n", pInfo->returnStatus, *pStatus);
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1134
#endif
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1135
		*pPid = pInfo->pid;
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1136
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1137
		/*
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1138
		 * link this infoBlock back to the freeList
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1139
		 */
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1140
		if (prevInfo) {
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1141
		    prevInfo->nextProc = pInfo->nextProc;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1142
		} else {
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1143
		    procInfoHead = pInfo->nextProc;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1144
		}
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1145
		pInfo->nextProc = procInfoFree;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1146
		procInfoFree = pInfo;
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1147
		return 1;
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1148
	    }
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1149
	}
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1150
    }
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1151
#ifdef WAITDEBUG
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1152
    printf("no child\r\n");
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1153
#endif
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1154
    return 0;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1155
}
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1156
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1157
#endif /* __VMS__ */
406
claus
parents: 384
diff changeset
  1158
%}
claus
parents: 384
diff changeset
  1159
! !
claus
parents: 384
diff changeset
  1160
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1161
!OperatingSystem primitiveVariables!
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1162
%{
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1163
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1164
#ifdef __VMS__
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1165
static struct procInfo *procInfoHead = (struct procInfo *)0;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1166
static struct procInfo *procInfoFree = (struct procInfo *)0;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1167
static unsigned char procEventFlag = 1;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1168
#endif
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1169
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1170
%}
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1171
! !
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  1172
1799
0a2c5890f4f3 handle 'foo///' in directoryName
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  1173
!OperatingSystem class methodsFor:'documentation'!
2
claus
parents: 1
diff changeset
  1174
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
  1175
copyright
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
  1176
"
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
  1177
 COPYRIGHT (c) 1988 by Claus Gittinger
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  1178
	      All Rights Reserved
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
  1179
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
  1180
 This software is furnished under a license and may be used
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
  1181
 only in accordance with the terms of that license and with the
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
  1182
 inclusion of the above copyright notice.   This software may not
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
  1183
 be provided or otherwise made available to, or used by, any
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
  1184
 other person.  No title to or ownership of the software is
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
  1185
 hereby transferred.
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
  1186
"
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
  1187
!
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
  1188
2
claus
parents: 1
diff changeset
  1189
documentation
claus
parents: 1
diff changeset
  1190
"
530
07d0bce293c9 uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents: 520
diff changeset
  1191
    this class realizes access to most (all ?) required operating system services;
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  1192
    some of it is very specific for unix, so do not depend on
1619
2ce129068706 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1617
diff changeset
  1193
    things available here in your applications 
2ce129068706 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1617
diff changeset
  1194
    - some may not be found in other OS's or be slightly different ...
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  1195
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  1196
    (On the other hand: I do not want to hide all features
759
908363ce8a32 interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 756
diff changeset
  1197
     from you - in some situations it MAY be interesting to be
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  1198
     able to get down to a select or fork system call easily (at least on Unix systems).
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  1199
     You decide - portability vs. functionality)
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  1200
1286
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
  1201
    [Class variables:]
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
  1202
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1203
	HostName        <String>        remembered hostname
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1204
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1205
	DomainName      <String>        remembered domainname
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1206
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1207
	LastErrorNumber <Integer>       the last value of errno
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1208
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1209
	OSSignals       <Array>         Array of signals to be raised for corresponding
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1210
					OperatingSystem signals.
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1211
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1212
	ForkFailed      <Boolean>       set if a fork (or popen) has failed;
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1213
					ST/X will avoid doing more forks/popens
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1214
					if this flag is set, for a slightly
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1215
					smoother operation.
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1216
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1217
	SlowFork        <Boolean>       if set, fork and popen are avoided;
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1218
					(more or less obsolete now)
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1219
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1220
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1221
	ErrorSignal     <Signal>        Parentsignal of all OS error signals.
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1222
					not directly raised.
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1223
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1224
	AccessDeniedErrorSignal
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1225
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1226
	FileNotFoundErrorSignal
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1227
2939
b7cebf237308 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2937
diff changeset
  1228
	UnsupportedOperationSignal
b7cebf237308 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2937
diff changeset
  1229
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1230
	LocaleInfo      <Dictionary>    if non nil, that is taken instead of the operating
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1231
					systems locale definitions (allows for overwriting
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1232
					these, or provide a compatible info on systems which do
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1233
					not support locales)
1286
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
  1234
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1235
	CurrentDirectory <String>       remembered currentDirectories path
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1236
1286
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
  1237
    [author:]
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1238
	Claus Gittinger
1286
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
  1239
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 1280
diff changeset
  1240
    [see also:]
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1241
	OSProcessStatus
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1242
	Filename Date Time
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1243
	ExternalStream FileStream PipeStream Socket
2
claus
parents: 1
diff changeset
  1244
"
1619
2ce129068706 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1617
diff changeset
  1245
!
2ce129068706 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1617
diff changeset
  1246
2ce129068706 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1617
diff changeset
  1247
examples
2ce129068706 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1617
diff changeset
  1248
"
1622
e40404e0a49d more examples
Claus Gittinger <cg@exept.de>
parents: 1621
diff changeset
  1249
  various queries
1632
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1250
								[exBegin]
1622
e40404e0a49d more examples
Claus Gittinger <cg@exept.de>
parents: 1621
diff changeset
  1251
    Transcript 
1632
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1252
	showCR:'hello ' , (OperatingSystem getLoginName)
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1253
								[exEnd]
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1254
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1255
								[exBegin]
1622
e40404e0a49d more examples
Claus Gittinger <cg@exept.de>
parents: 1621
diff changeset
  1256
    OperatingSystem isUNIXlike ifTrue:[
1632
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1257
	Transcript showCR:'this is some UNIX-like OS'
1622
e40404e0a49d more examples
Claus Gittinger <cg@exept.de>
parents: 1621
diff changeset
  1258
    ] ifFalse:[
1632
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1259
	Transcript showCR:'this OS is not UNIX-like'
1622
e40404e0a49d more examples
Claus Gittinger <cg@exept.de>
parents: 1621
diff changeset
  1260
    ]
1632
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1261
								[exEnd]
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1262
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1263
								[exBegin]
1622
e40404e0a49d more examples
Claus Gittinger <cg@exept.de>
parents: 1621
diff changeset
  1264
    Transcript 
1632
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1265
	showCR:'this machine is called ' , OperatingSystem getHostName
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1266
								[exEnd]
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1267
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1268
								[exBegin]
1622
e40404e0a49d more examples
Claus Gittinger <cg@exept.de>
parents: 1621
diff changeset
  1269
    Transcript 
1632
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1270
	showCR:('this machine is in the '
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1271
	       , OperatingSystem getDomainName
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1272
	       , ' domain')
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1273
								[exEnd]
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1274
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1275
								[exBegin]
1622
e40404e0a49d more examples
Claus Gittinger <cg@exept.de>
parents: 1621
diff changeset
  1276
    Transcript 
1632
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1277
	showCR:('this machine''s CPU is a '
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1278
	       , OperatingSystem getCPUType
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1279
	       )
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1280
								[exEnd]
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1281
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1282
								[exBegin]
1622
e40404e0a49d more examples
Claus Gittinger <cg@exept.de>
parents: 1621
diff changeset
  1283
    Transcript showCR:'executing ls command ...'.
e40404e0a49d more examples
Claus Gittinger <cg@exept.de>
parents: 1621
diff changeset
  1284
    OperatingSystem executeCommand:'ls'.
e40404e0a49d more examples
Claus Gittinger <cg@exept.de>
parents: 1621
diff changeset
  1285
    Transcript showCR:'... done.'.
1632
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1286
								[exEnd]
1622
e40404e0a49d more examples
Claus Gittinger <cg@exept.de>
parents: 1621
diff changeset
  1287
1621
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  1288
  locking a file 
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  1289
  (should be executed on two running smalltalks - not in two threads):
1632
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1290
								[exBegin]
1621
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  1291
    |f|
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  1292
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  1293
    f := 'testFile' asFilename readWriteStream.
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  1294
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  1295
    10 timesRepeat:[
1632
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1296
	'about to lock ...' printCR.
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1297
	[
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1298
	  OperatingSystem 
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1299
	    lockFD:(f fileDescriptor)
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1300
	    shared:false
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1301
	    blocking:false
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1302
	] whileFalse:[
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1303
	    'process ' print. OperatingSystem getProcessId print. ' is waiting' printCR.
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1304
	    Delay waitForSeconds:1
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1305
	].
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1306
	'LOCKED ...' printCR.
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1307
	Delay waitForSeconds:10.
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1308
	'unlock ...' printCR.
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1309
	(OperatingSystem 
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1310
	    unlockFD:(f fileDescriptor)) printCR.
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1311
	Delay waitForSeconds:3.
1621
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  1312
    ]
1632
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  1313
								[exBegin]
1619
2ce129068706 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1617
diff changeset
  1314
"
2
claus
parents: 1
diff changeset
  1315
! !
claus
parents: 1
diff changeset
  1316
1799
0a2c5890f4f3 handle 'foo///' in directoryName
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  1317
!OperatingSystem class methodsFor:'initialization'!
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  1318
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  1319
initialize
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  1320
    "initialize the class"
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  1321
540
c34cd0a2fd5f OS signals added (more to come)
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1322
    ObjectMemory addDependent:self.
c34cd0a2fd5f OS signals added (more to come)
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1323
c34cd0a2fd5f OS signals added (more to come)
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1324
    ErrorSignal isNil ifTrue:[
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1325
	ErrorSignal := Object errorSignal newSignalMayProceed:true.
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1326
	ErrorSignal nameClass:self message:#errorSignal.
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1327
	ErrorSignal notifierString:'OS error encountered'.
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1328
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1329
	AccessDeniedErrorSignal := ErrorSignal newSignalMayProceed:true.
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1330
	AccessDeniedErrorSignal nameClass:self message:#accessDeniedError.
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1331
	AccessDeniedErrorSignal notifierString:'OS access denied'.
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1332
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1333
	FileNotFoundErrorSignal := ErrorSignal newSignalMayProceed:true.
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1334
	FileNotFoundErrorSignal nameClass:self message:#fileNotFoundErrorSignal.
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1335
	FileNotFoundErrorSignal notifierString:'OS file not found'.
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1336
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1337
	InvalidArgumentsSignal := ErrorSignal newSignalMayProceed:true.
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1338
	InvalidArgumentsSignal nameClass:self message:#invalidArgumentsSignal.
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1339
	InvalidArgumentsSignal notifierString:'bad arg to OS call'.
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1340
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1341
	UnsupportedOperationSignal := ErrorSignal newSignalMayProceed:true.
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1342
	UnsupportedOperationSignal nameClass:self message:#unsupportedOperationSignal.
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  1343
	UnsupportedOperationSignal notifierString:'operation not supported by OS'.
540
c34cd0a2fd5f OS signals added (more to come)
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1344
    ]
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1345
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1346
    "Modified: 13.9.1997 / 10:47:32 / cg"
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  1347
!
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  1348
1470
266520246a88 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1441
diff changeset
  1349
update:something with:aParameter from:changedObject
1247
2716d915e84e commentary
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  1350
    "catch image restart and flush some cached data"
2716d915e84e commentary
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  1351
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  1352
    something == #earlyRestart ifTrue:[
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1353
	"
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1354
	 flush cached data
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1355
	"
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1356
	HostName := nil.
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1357
	DomainName := nil.
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1358
	LastErrorNumber := nil.
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  1359
    ]
1247
2716d915e84e commentary
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  1360
2716d915e84e commentary
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  1361
    "Modified: 22.4.1996 / 13:10:43 / cg"
1470
266520246a88 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1441
diff changeset
  1362
    "Created: 15.6.1996 / 15:22:37 / cg"
2080
d93d4af439d7 Use #executeCommand:onError: to implement #executeCommand:.
Stefan Vogel <sv@exept.de>
parents: 2073
diff changeset
  1363
    "Modified: 7.1.1997 / 19:36:11 / stefan"
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  1364
! !
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  1365
1799
0a2c5890f4f3 handle 'foo///' in directoryName
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  1366
!OperatingSystem class methodsFor:'OS signal constants'!
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1367
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1368
sigABRT
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1369
    "return the signal number for SIGABRT - 0 if not supported by OS
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1370
     (the numeric value is not the same across unix-systems)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1371
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1372
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1373
#ifdef SIGABRT
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1374
    RETURN ( __MKSMALLINT(SIGABRT) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1375
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1376
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1377
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1378
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1379
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1380
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1381
sigALRM
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1382
    "return the signal number for SIGALRM - 0 if not supported
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1383
     (the numeric value is not the same across unix-systems)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1384
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1385
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1386
#ifdef SIGALRM
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1387
    RETURN ( __MKSMALLINT(SIGALRM) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1388
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1389
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1390
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1391
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1392
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1393
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  1394
sigBREAK
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  1395
    "return the signal number for SIGBREAK - 0 if not supported.
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  1396
     This is an MSDOS specific signal"
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  1397
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  1398
%{  /* NOCONTEXT */
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  1399
#ifdef SIGBREAK
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1400
    RETURN ( __MKSMALLINT(SIGBREAK) );
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  1401
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1402
    RETURN ( __MKSMALLINT(0) );
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  1403
#endif
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  1404
%}
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  1405
!
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  1406
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1407
sigBUS
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1408
    "return the signal number for SIGBUS - 0 if not supported
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1409
     (the numeric value is not the same across unix-systems)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1410
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1411
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1412
#ifdef SIGBUS
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1413
    RETURN ( __MKSMALLINT(SIGBUS) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1414
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1415
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1416
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1417
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1418
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1419
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1420
sigCHLD
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1421
    "return the signal number for SIGCHLD - 0 if not supported
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1422
     (the numeric value is not the same across unix-systems)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1423
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1424
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1425
#if defined(SIGCHLD)
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1426
    RETURN ( __MKSMALLINT(SIGCHLD) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1427
#else
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1428
# if  defined(SIGCLD)
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1429
    RETURN ( __MKSMALLINT(SIGCLD) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1430
# else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1431
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1432
# endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1433
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1434
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1435
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1436
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1437
sigCONT
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1438
    "return the signal number for SIGCONT - 0 if not supported
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1439
     (the numeric value is not the same across unix-systems)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1440
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1441
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1442
#if defined(SIGCONT)
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1443
    RETURN ( __MKSMALLINT(SIGCONT) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1444
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1445
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1446
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1447
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1448
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1449
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1450
sigDANGER
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1451
    "return the signal number for SIGDANGER - 0 if not supported
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1452
     (seems to be an AIX special)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1453
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1454
%{  /* NOCONTEXT */
710
10d86ca4c4a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 704
diff changeset
  1455
#if defined(SIGDANGER)
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1456
    RETURN ( __MKSMALLINT(SIGDANGER) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1457
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1458
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1459
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1460
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1461
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1462
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1463
sigEMT
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1464
    "return the signal number for SIGEMT - 0 if not supported by OS
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1465
     (the numeric value is not the same across unix-systems)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1466
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1467
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1468
#ifdef SIGEMT
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1469
    RETURN ( __MKSMALLINT(SIGEMT) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1470
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1471
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1472
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1473
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1474
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1475
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1476
sigFP
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1477
    "return the signal number for SIGFP - 0 if not supported by OS
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1478
     (the numeric value is not the same across unix-systems)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1479
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1480
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1481
#ifdef SIGFPE
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1482
    RETURN ( __MKSMALLINT(SIGFPE) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1483
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1484
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1485
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1486
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1487
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1488
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1489
sigGRANT
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1490
    "return the signal number for SIGGRANT - 0 if not supported
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1491
     (seems to be an AIX special)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1492
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1493
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1494
#if defined(SIGGRANT)
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1495
    RETURN ( __MKSMALLINT(SIGGRANT) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1496
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1497
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1498
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1499
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1500
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1501
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1502
sigHUP
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1503
    "return the signal number for SIGHUP
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1504
     (the numeric value is not the same across unix-systems)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1505
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1506
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1507
#ifdef SIGHUP
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1508
    RETURN ( __MKSMALLINT(SIGHUP) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1509
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1510
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1511
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1512
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1513
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1514
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1515
sigILL
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1516
    "return the signal number for SIGILL - 0 if not supported by OS
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1517
     (the numeric value is not the same across unix-systems)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1518
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1519
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1520
#ifdef SIGILL
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1521
    RETURN ( __MKSMALLINT(SIGILL) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1522
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1523
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1524
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1525
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1526
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1527
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1528
sigINT
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1529
    "return the signal number for SIGINT
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1530
     (the numeric value is not the same across unix-systems)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1531
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1532
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1533
#ifdef SIGINT
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1534
    RETURN ( __MKSMALLINT(SIGINT) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1535
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1536
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1537
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1538
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1539
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1540
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1541
sigIO
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1542
    "return the signal number for SIGIO - 0 if not supported
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1543
     (the numeric value is not the same across unix-systems)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1544
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1545
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1546
#if defined(SIGIO)
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1547
    RETURN ( __MKSMALLINT(SIGIO) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1548
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1549
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1550
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1551
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1552
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1553
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1554
sigIOT
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1555
    "return the signal number for SIGIOT - 0 if not supported by OS
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1556
     (the numeric value is not the same across unix-systems)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1557
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1558
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1559
#ifdef SIGIOT
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1560
    RETURN ( __MKSMALLINT(SIGIOT) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1561
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1562
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1563
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1564
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1565
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1566
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1567
sigKILL
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1568
    "return the signal number for SIGKILL
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1569
     (the numeric value is not the same across unix-systems)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1570
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1571
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1572
#ifdef SIGKILL
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1573
    RETURN ( __MKSMALLINT(SIGKILL) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1574
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1575
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1576
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1577
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1578
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1579
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1580
sigLOST
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1581
    "return the signal number for SIGLOST - 0 if not supported
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1582
     (the numeric value is not the same across unix-systems)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1583
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1584
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1585
#if defined(SIGLOST)
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1586
    RETURN ( __MKSMALLINT(SIGLOST) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1587
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1588
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1589
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1590
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1591
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1592
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1593
sigMIGRATE
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1594
    "return the signal number for SIGMIGRATE - 0 if not supported
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1595
     (seems to be an AIX special)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1596
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1597
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1598
#if defined(SIGMIGRATE)
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1599
    RETURN ( __MKSMALLINT(SIGMIGRATE) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1600
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1601
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1602
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1603
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1604
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1605
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1606
sigMSG
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1607
    "return the signal number for SIGMSG - 0 if not supported
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1608
     (seems to be an AIX special)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1609
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1610
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1611
#if defined(SIGMSG)
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1612
    RETURN ( __MKSMALLINT(SIGMSG) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1613
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1614
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1615
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1616
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1617
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1618
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1619
sigPIPE
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1620
    "return the signal number for SIGPIPE - 0 if not supported
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1621
     (the numeric value is not the same across unix-systems)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1622
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1623
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1624
#ifdef SIGPIPE
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1625
    RETURN ( __MKSMALLINT(SIGPIPE) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1626
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1627
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1628
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1629
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1630
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1631
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1632
sigPOLL
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1633
    "return the signal number for SIGPOLL - 0 if not supported
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1634
     (the numeric value is not the same across unix-systems)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1635
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1636
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1637
#if defined(SIGPOLL)
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1638
    RETURN ( __MKSMALLINT(SIGPOLL) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1639
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1640
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1641
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1642
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1643
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1644
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1645
sigPRE
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1646
    "return the signal number for SIGPRE - 0 if not supported
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1647
     (seems to be an AIX special)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1648
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1649
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1650
#if defined(SIGPRE)
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1651
    RETURN ( __MKSMALLINT(SIGPRE) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1652
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1653
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1654
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1655
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1656
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1657
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1658
sigPROF
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1659
    "return the signal number for SIGPROF - 0 if not supported
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1660
     (the numeric value is not the same across unix-systems)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1661
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1662
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1663
#if defined(SIGPROF)
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1664
    RETURN ( __MKSMALLINT(SIGPROF) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1665
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1666
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1667
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1668
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1669
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1670
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1671
sigPWR
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1672
    "return the signal number for SIGPWR - 0 if not supported
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1673
     (not available on all systems)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1674
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1675
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1676
#if defined(SIGPWR)
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1677
    RETURN ( __MKSMALLINT(SIGPWR) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1678
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1679
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1680
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1681
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1682
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1683
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1684
sigQUIT
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1685
    "return the signal number for SIGQUIT
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1686
     (the numeric value is not the same across unix-systems)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1687
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1688
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1689
#ifdef SIGQUIT
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1690
    RETURN ( __MKSMALLINT(SIGQUIT) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1691
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1692
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1693
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1694
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1695
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1696
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1697
sigRETRACT
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1698
    "return the signal number for SIGRETRACT - 0 if not supported
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1699
     (seems to be an AIX special)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1700
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1701
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1702
#if defined(SIGRETRACT)
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1703
    RETURN ( __MKSMALLINT(SIGRETRACT) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1704
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1705
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1706
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1707
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1708
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1709
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1710
sigSAK
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1711
    "return the signal number for SIGSAK - 0 if not supported
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1712
     (seems to be an AIX special)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1713
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1714
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1715
#if defined(SIGSAK)
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1716
    RETURN ( __MKSMALLINT(SIGSAK) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1717
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1718
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1719
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1720
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1721
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1722
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1723
sigSEGV
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1724
    "return the signal number for SIGSEGV - 0 if not supported
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1725
     (the numeric value is not the same across unix-systems)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1726
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1727
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1728
#ifdef SIGSEGV
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1729
    RETURN ( __MKSMALLINT(SIGSEGV) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1730
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1731
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1732
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1733
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1734
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1735
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1736
sigSOUND
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1737
    "return the signal number for SIGSOUND - 0 if not supported
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1738
     (seems to be an AIX special)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1739
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1740
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1741
#if defined(SIGSOUND)
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1742
    RETURN ( __MKSMALLINT(SIGSOUND) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1743
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1744
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1745
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1746
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1747
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1748
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1749
sigSTOP
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1750
    "return the signal number for SIGSTOP - 0 if not supported
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1751
     (the numeric value is not the same across unix-systems)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1752
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1753
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1754
#if defined(SIGSTOP)
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1755
    RETURN ( __MKSMALLINT(SIGSTOP) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1756
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1757
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1758
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1759
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1760
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1761
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1762
sigSYS
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1763
    "return the signal number for SIGSYS - 0 if not supported
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1764
     (the numeric value is not the same across unix-systems)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1765
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1766
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1767
#ifdef SIGSYS
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1768
    RETURN ( __MKSMALLINT(SIGSYS) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1769
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1770
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1771
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1772
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1773
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1774
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1775
sigTERM
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1776
    "return the signal number for SIGTERM - 0 if not supported
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1777
     (the numeric value is not the same across unix-systems)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1778
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1779
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1780
#ifdef SIGTERM
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1781
    RETURN ( __MKSMALLINT(SIGTERM) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1782
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1783
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1784
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1785
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1786
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1787
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1788
sigTRAP
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1789
    "return the signal number for SIGTRAP - 0 if not supported by OS
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1790
     (the numeric value is not the same across unix-systems)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1791
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1792
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1793
#ifdef SIGTRAP
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1794
    RETURN ( __MKSMALLINT(SIGTRAP) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1795
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1796
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1797
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1798
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1799
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1800
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1801
sigTSTP
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1802
    "return the signal number for SIGTSTP - 0 if not supported
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1803
     (the numeric value is not the same across unix-systems)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1804
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1805
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1806
#if defined(SIGTSTP)
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1807
    RETURN ( __MKSMALLINT(SIGTSTP) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1808
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1809
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1810
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1811
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1812
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1813
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1814
sigTTIN
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1815
    "return the signal number for SIGTTIN - 0 if not supported
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1816
     (the numeric value is not the same across unix-systems)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1817
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1818
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1819
#if defined(SIGTTIN)
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1820
    RETURN ( __MKSMALLINT(SIGTTIN) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1821
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1822
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1823
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1824
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1825
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1826
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1827
sigTTOU
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1828
    "return the signal number for SIGTTOU - 0 if not supported
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1829
     (the numeric value is not the same across unix-systems)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1830
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1831
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1832
#if defined(SIGTTOU)
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1833
    RETURN ( __MKSMALLINT(SIGTTOU) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1834
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1835
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1836
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1837
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1838
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1839
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1840
sigURG
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1841
    "return the signal number for SIGURG - 0 if not supported
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1842
     (the numeric value is not the same across unix-systems)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1843
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1844
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1845
#if defined(SIGURG)
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1846
    RETURN ( __MKSMALLINT(SIGURG) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1847
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1848
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1849
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1850
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1851
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1852
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1853
sigUSR1
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1854
    "return the signal number for SIGUSR1 - 0 if not supported
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1855
     (the numeric value is not the same across unix-systems)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1856
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1857
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1858
#if defined(SIGUSR1)
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1859
    RETURN ( __MKSMALLINT(SIGUSR1) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1860
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1861
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1862
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1863
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1864
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1865
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1866
sigUSR2
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1867
    "return the signal number for SIGUSR2 - 0 if not supported
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1868
     (the numeric value is not the same across unix-systems)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1869
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1870
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1871
#if defined(SIGUSR2)
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1872
    RETURN ( __MKSMALLINT(SIGUSR2) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1873
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1874
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1875
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1876
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1877
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1878
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1879
sigVTALRM
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1880
    "return the signal number for SIGVTALRM - 0 if not supported
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1881
     (the numeric value is not the same across unix-systems)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1882
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1883
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1884
#if defined(SIGVTALRM)
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1885
    RETURN ( __MKSMALLINT(SIGVTALRM) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1886
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1887
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1888
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1889
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1890
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1891
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1892
sigWINCH
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1893
    "return the signal number for SIGWINCH - 0 if not supported
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1894
     (the numeric value is not the same across unix-systems)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1895
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1896
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1897
#if defined(SIGWINCH)
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1898
    RETURN ( __MKSMALLINT(SIGWINCH) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1899
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1900
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1901
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1902
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1903
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1904
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1905
sigXCPU
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1906
    "return the signal number for SIGXCPU - 0 if not supported
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1907
     (the numeric value is not the same across unix-systems)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1908
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1909
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1910
#if defined(SIGXCPU)
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1911
    RETURN ( __MKSMALLINT(SIGXCPU) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1912
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1913
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1914
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1915
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1916
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1917
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1918
sigXFSZ
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1919
    "return the signal number for SIGXFSZ - 0 if not supported
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1920
     (the numeric value is not the same across unix-systems)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1921
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1922
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1923
#if defined(SIGXFSZ)
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1924
    RETURN ( __MKSMALLINT(SIGXFSZ) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1925
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1926
    RETURN ( __MKSMALLINT(0) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1927
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1928
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1929
! !
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1930
1799
0a2c5890f4f3 handle 'foo///' in directoryName
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  1931
!OperatingSystem class methodsFor:'Signal constants'!
540
c34cd0a2fd5f OS signals added (more to come)
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1932
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1933
accessDeniedErrorSignal
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1934
    "return the signal raised when a (file-) access is denied."
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1935
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1936
    ^ AccessDeniedErrorSignal
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1937
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1938
540
c34cd0a2fd5f OS signals added (more to come)
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1939
errorSignal
1247
2716d915e84e commentary
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  1940
    "return the parent signal of all OS signals."
540
c34cd0a2fd5f OS signals added (more to come)
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1941
c34cd0a2fd5f OS signals added (more to come)
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1942
    ^ ErrorSignal
1247
2716d915e84e commentary
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  1943
2716d915e84e commentary
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  1944
    "Modified: 22.4.1996 / 13:11:31 / cg"
540
c34cd0a2fd5f OS signals added (more to come)
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1945
!
c34cd0a2fd5f OS signals added (more to come)
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1946
c34cd0a2fd5f OS signals added (more to come)
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1947
fileNotFoundErrorSignal
c34cd0a2fd5f OS signals added (more to come)
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1948
    "return the signal raised when a file was not found."
c34cd0a2fd5f OS signals added (more to come)
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1949
c34cd0a2fd5f OS signals added (more to come)
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1950
    ^ FileNotFoundErrorSignal
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1951
!
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1952
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1953
invalidArgumentsSignal
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1954
    "return the signal which is raised for invalid arguments.
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1955
     Currently, this is never raised."
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1956
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1957
    ^ InvalidArgumentsSignal
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1958
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1959
    "Created: 13.9.1997 / 10:46:47 / cg"
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  1960
    "Modified: 13.9.1997 / 10:47:03 / cg"
2939
b7cebf237308 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2937
diff changeset
  1961
!
b7cebf237308 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2937
diff changeset
  1962
b7cebf237308 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2937
diff changeset
  1963
unsupportedOperationSignal
b7cebf237308 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2937
diff changeset
  1964
    "return the signal which is raised when an operation
b7cebf237308 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2937
diff changeset
  1965
     is attempted, which is not supported by the OS.
b7cebf237308 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2937
diff changeset
  1966
     (For example, creating a link on VMS or MSDOS)"
b7cebf237308 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2937
diff changeset
  1967
b7cebf237308 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2937
diff changeset
  1968
    ^ UnsupportedOperationSignal
540
c34cd0a2fd5f OS signals added (more to come)
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1969
! !
c34cd0a2fd5f OS signals added (more to come)
Claus Gittinger <cg@exept.de>
parents: 535
diff changeset
  1970
1799
0a2c5890f4f3 handle 'foo///' in directoryName
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  1971
!OperatingSystem class methodsFor:'error messages'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1972
1153
8119975c55ce Fix errorSymbolForNumber, add clearLastErrorNumber.
Stefan Vogel <sv@exept.de>
parents: 1142
diff changeset
  1973
clearLastErrorNumber
8119975c55ce Fix errorSymbolForNumber, add clearLastErrorNumber.
Stefan Vogel <sv@exept.de>
parents: 1142
diff changeset
  1974
    "return the last errors number.
8119975c55ce Fix errorSymbolForNumber, add clearLastErrorNumber.
Stefan Vogel <sv@exept.de>
parents: 1142
diff changeset
  1975
     See also: #lastErrorSymbol and #lastErrorString.
8119975c55ce Fix errorSymbolForNumber, add clearLastErrorNumber.
Stefan Vogel <sv@exept.de>
parents: 1142
diff changeset
  1976
     Notice: having a single error number is a bad idea in a multithreaded
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  1977
	     environment - this interface will change."
1153
8119975c55ce Fix errorSymbolForNumber, add clearLastErrorNumber.
Stefan Vogel <sv@exept.de>
parents: 1142
diff changeset
  1978
8119975c55ce Fix errorSymbolForNumber, add clearLastErrorNumber.
Stefan Vogel <sv@exept.de>
parents: 1142
diff changeset
  1979
    LastErrorNumber := nil.
8119975c55ce Fix errorSymbolForNumber, add clearLastErrorNumber.
Stefan Vogel <sv@exept.de>
parents: 1142
diff changeset
  1980
8119975c55ce Fix errorSymbolForNumber, add clearLastErrorNumber.
Stefan Vogel <sv@exept.de>
parents: 1142
diff changeset
  1981
     "
8119975c55ce Fix errorSymbolForNumber, add clearLastErrorNumber.
Stefan Vogel <sv@exept.de>
parents: 1142
diff changeset
  1982
      OperatingSystem clearLastErrorNumber
8119975c55ce Fix errorSymbolForNumber, add clearLastErrorNumber.
Stefan Vogel <sv@exept.de>
parents: 1142
diff changeset
  1983
     "
8119975c55ce Fix errorSymbolForNumber, add clearLastErrorNumber.
Stefan Vogel <sv@exept.de>
parents: 1142
diff changeset
  1984
8119975c55ce Fix errorSymbolForNumber, add clearLastErrorNumber.
Stefan Vogel <sv@exept.de>
parents: 1142
diff changeset
  1985
    "Created: 12.4.1996 / 09:28:58 / stefan"
8119975c55ce Fix errorSymbolForNumber, add clearLastErrorNumber.
Stefan Vogel <sv@exept.de>
parents: 1142
diff changeset
  1986
    "Modified: 12.4.1996 / 09:38:51 / stefan"
8119975c55ce Fix errorSymbolForNumber, add clearLastErrorNumber.
Stefan Vogel <sv@exept.de>
parents: 1142
diff changeset
  1987
!
8119975c55ce Fix errorSymbolForNumber, add clearLastErrorNumber.
Stefan Vogel <sv@exept.de>
parents: 1142
diff changeset
  1988
85
claus
parents: 77
diff changeset
  1989
currentErrorNumber
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  1990
    "returns the OS's last error nr (i.e. the value of errno).
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  1991
     Notice, that the value of this flag is only valid immediately
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  1992
     after the error occurred - it gets updated with every other
85
claus
parents: 77
diff changeset
  1993
     request to the OS.
claus
parents: 77
diff changeset
  1994
     Use lastErrorNumber - currentErrorNumber is invalidated by
claus
parents: 77
diff changeset
  1995
     many, many internal calls."
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  1996
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  1997
%{  /* NOCONTEXT */
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  1998
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  1999
     RETURN ( __MKSMALLINT(errno) );
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  2000
%}
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  2001
     "
85
claus
parents: 77
diff changeset
  2002
      OperatingSystem currentErrorNumber
claus
parents: 77
diff changeset
  2003
     "
claus
parents: 77
diff changeset
  2004
!
claus
parents: 77
diff changeset
  2005
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2006
errorNumberFor:aSymbol
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2007
    "given a symbolic error, return the numeric;
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2008
     (i.e. errorNumberFor:#EBADF returns EBADF's value).
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2009
     Use this, since error numbers are really not standard across unix systems."
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2010
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2011
%{   /* NOCONTEXT */
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2012
    OBJ sym = aSymbol;
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2013
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2014
    /*
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2015
     * POSIX errnos - these should be defined
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2016
     */
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2017
#ifdef EPERM
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2018
    if (sym == @symbol(EPERM)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2019
	RETURN ( __MKSMALLINT(EPERM) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2020
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2021
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2022
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2023
#ifdef ENOENT
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2024
    if (sym == @symbol(ENOENT)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2025
	RETURN ( __MKSMALLINT(ENOENT) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2026
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2027
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2028
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2029
#ifdef ESRCH
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2030
    if (sym == @symbol(ESRCH)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2031
	RETURN ( __MKSMALLINT(ESRCH) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2032
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2033
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2034
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2035
#ifdef EINTR
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2036
    if (sym == @symbol(EINTR)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2037
	RETURN ( __MKSMALLINT(EINTR) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2038
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2039
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2040
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2041
#ifdef EIO
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2042
    if (sym == @symbol(EIO)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2043
	RETURN ( __MKSMALLINT(EIO) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2044
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2045
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2046
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2047
#ifdef ENXIO
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2048
    if (sym == @symbol(ENXIO)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2049
	RETURN ( __MKSMALLINT(ENXIO) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2050
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2051
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2052
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2053
#ifdef E2BIG
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2054
    if (sym == @symbol(E2BIG)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2055
	RETURN ( __MKSMALLINT(E2BIG) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2056
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2057
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2059
#ifdef ENOEXEC
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2060
    if (sym == @symbol(ENOEXEC)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2061
	RETURN ( __MKSMALLINT(ENOEXEC) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2062
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2063
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2064
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2065
#ifdef EBADF
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2066
    if (sym == @symbol(EBADF)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2067
	RETURN ( __MKSMALLINT(EBADF) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2068
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2069
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2070
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2071
#ifdef ECHILD
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2072
    if (sym == @symbol(ECHILD)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2073
	RETURN ( __MKSMALLINT(ECHILD) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2074
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2075
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2076
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2077
#if defined(EAGAIN)
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2078
    if (sym == @symbol(EAGAIN)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2079
	RETURN ( __MKSMALLINT(EAGAIN) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2080
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2081
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2082
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2083
#ifdef ENOMEM
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2084
    if (sym == @symbol(ENOMEM)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2085
	RETURN ( __MKSMALLINT(ENOMEM) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2086
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2087
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2088
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2089
#ifdef EACCES
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2090
    if (sym == @symbol(EACCES)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2091
	RETURN ( __MKSMALLINT(EACCES) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2092
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2093
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2094
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2095
#ifdef EFAULT
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2096
    if (sym == @symbol(EFAULT)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2097
	RETURN ( __MKSMALLINT(EFAULT) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2098
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2099
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2100
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2101
#ifdef EBUSY
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2102
    if (sym == @symbol(EBUSY)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2103
	RETURN ( __MKSMALLINT(EBUSY) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2104
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2105
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2106
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2107
#ifdef EXDEV
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2108
    if (sym == @symbol(EXDEV)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2109
	RETURN ( __MKSMALLINT(EXDEV) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2110
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2111
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2112
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2113
#ifdef ENODEV
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2114
    if (sym == @symbol(ENODEV)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2115
	RETURN ( __MKSMALLINT(ENODEV) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2116
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2117
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2118
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2119
#ifdef ENOTDIR
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2120
    if (sym == @symbol(ENOTDIR)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2121
	RETURN ( __MKSMALLINT(ENOTDIR) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2122
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2123
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2124
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2125
#ifdef EISDIR
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2126
    if (sym == @symbol(EISDIR)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2127
	RETURN ( __MKSMALLINT(EISDIR) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2128
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2129
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2130
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2131
#ifdef EINVAL
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2132
    if (sym == @symbol(EINVAL)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2133
	RETURN ( __MKSMALLINT(EINVAL) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2134
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2135
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2136
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2137
#ifdef ENFILE
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2138
    if (sym == @symbol(ENFILE)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2139
	RETURN ( __MKSMALLINT(ENFILE) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2140
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2141
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2142
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2143
#ifdef EMFILE
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2144
    if (sym == @symbol(EMFILE)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2145
	RETURN ( __MKSMALLINT(EMFILE) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2146
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2147
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2148
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2149
#ifdef ENOTTY
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2150
    if (sym == @symbol(ENOTTY)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2151
	RETURN ( __MKSMALLINT(ENOTTY) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2152
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2153
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2154
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2155
#ifdef EFBIG
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2156
    if (sym == @symbol(EFBIG)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2157
	RETURN ( __MKSMALLINT(EFBIG) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2158
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2159
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2160
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2161
#ifdef ENOSPC
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2162
    if (sym == @symbol(ENOSPC)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2163
	RETURN ( __MKSMALLINT(ENOSPC) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2164
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2165
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2166
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2167
#ifdef ESPIPE
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2168
    if (sym == @symbol(ESPIPE)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2169
	RETURN ( __MKSMALLINT(ESPIPE) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2170
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2171
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2172
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2173
#ifdef EROFS
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2174
    if (sym == @symbol(EROFS)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2175
	RETURN ( __MKSMALLINT(EROFS) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2176
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2177
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2178
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2179
#ifdef EMLINK
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2180
    if (sym == @symbol(EMLINK)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2181
	RETURN ( __MKSMALLINT(EMLINK) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2182
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2183
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2184
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2185
#ifdef EPIPE
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2186
    if (sym == @symbol(EPIPE)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2187
	RETURN ( __MKSMALLINT(EPIPE) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2188
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2189
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2190
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2191
#ifdef EDOM
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2192
    if (sym == @symbol(EDOM)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2193
	RETURN ( __MKSMALLINT(EDOM) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2194
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2195
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2196
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2197
#ifdef ERANGE
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2198
    if (sym == @symbol(ERANGE)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2199
	RETURN ( __MKSMALLINT(ERANGE) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2200
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2201
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2202
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2203
#ifdef EDEADLK
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2204
    if (sym == @symbol(EDEADLK)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2205
	RETURN ( __MKSMALLINT(EDEADLK) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2206
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2207
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2208
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2209
#ifdef ENAMETOOLONG
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2210
    if (sym == @symbol(ENAMETOOLONG)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2211
	RETURN ( __MKSMALLINT(ENAMETOOLONG) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2212
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2213
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2214
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2215
#ifdef ENOLCK
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2216
    if (sym == @symbol(ENOLCK)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2217
	RETURN ( __MKSMALLINT(ENOLCK) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2218
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2219
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2220
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2221
#ifdef ENOSYS
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2222
    if (sym == @symbol(ENOSYS)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2223
	RETURN ( __MKSMALLINT(ENOSYS) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2224
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2225
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2226
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2227
#ifdef ENOTEMPTY
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2228
    if (sym == @symbol(ENOTEMPTY)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2229
	RETURN ( __MKSMALLINT(ENOTEMPTY) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2230
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2231
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2232
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2233
#ifdef EEXIST
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2234
    if (sym == @symbol(EEXIST)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2235
	RETURN ( __MKSMALLINT(EEXIST) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2236
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2237
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2238
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2239
#ifdef EILSEQ
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2240
    if (sym == @symbol(EILSEQ)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2241
	RETURN ( __MKSMALLINT(EILSEQ) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2242
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2243
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2244
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2245
    /*
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2246
     * XPG3 errnos - defined on most systems
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2247
     */
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2248
#ifdef ENOTBLK
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2249
    if (sym == @symbol(ENOTBLK)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2250
	RETURN ( __MKSMALLINT(ENOTBLK) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2251
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2252
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2253
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2254
#ifdef ETXTBSY
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2255
    if (sym == @symbol(ETXTBSY)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2256
	RETURN ( __MKSMALLINT(ETXTBSY) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2257
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2258
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2259
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2260
    /*
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2261
     * some others
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2262
     */
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2263
#ifdef EWOULDBLOCK
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2264
    if (sym == @symbol(EWOULDBLOCK)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2265
	RETURN ( __MKSMALLINT(EWOULDBLOCK) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2266
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2267
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2268
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2269
#ifdef ENOMSG
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2270
    if (sym == @symbol(ENOMSG)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2271
	RETURN ( __MKSMALLINT(ENOMSG) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2272
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2273
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2274
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2275
#ifdef ELOOP
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2276
    if (sym == @symbol(ELOOP)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2277
	RETURN ( __MKSMALLINT(ELOOP) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2278
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2279
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2280
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2281
    /*
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2282
     * some stream errors
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2283
     */
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2284
#ifdef ETIME
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2285
    if (sym == @symbol(ETIME)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2286
	RETURN ( __MKSMALLINT(ETIME) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2287
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2288
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2289
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2290
#ifdef ENOSR
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2291
    if (sym == @symbol(ENOSR)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2292
	RETURN ( __MKSMALLINT(ENOSR) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2293
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2294
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2295
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2296
#ifdef ENOSTR
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2297
    if (sym == @symbol(ENOSTR)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2298
	RETURN ( __MKSMALLINT(ENOSTR) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2299
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2300
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2301
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2302
#ifdef ECOMM
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2303
    if (sym == @symbol(ECOMM)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2304
	RETURN ( __MKSMALLINT(ECOMM) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2305
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2306
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2307
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2308
#ifdef EPROTO
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2309
    if (sym == @symbol(EPROTO)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2310
	RETURN ( __MKSMALLINT(EPROTO) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2311
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2312
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2313
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2314
    /*
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2315
     * nfs errors
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2316
     */
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2317
#ifdef ESTALE
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2318
    if (sym == @symbol(ESTALE)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2319
	RETURN ( __MKSMALLINT(ESTALE) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2320
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2321
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2322
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2323
#ifdef EREMOTE
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2324
    if (sym == @symbol(EREMOTE)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2325
	RETURN ( __MKSMALLINT(EREMOTE) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2326
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2327
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2328
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2329
    /*
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2330
     * some networking errors
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2331
     */
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2332
#ifdef EINPROGRESS
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2333
    if (sym == @symbol(EINPROGRESS)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2334
	RETURN ( __MKSMALLINT(EINPROGRESS) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2335
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2336
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2337
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2338
#ifdef EALREADY
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2339
    if (sym == @symbol(EALREADY)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2340
	RETURN ( __MKSMALLINT(EALREADY) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2341
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2342
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2343
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2344
#ifdef ENOTSOCK
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2345
    if (sym == @symbol(ENOTSOCK)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2346
	RETURN ( __MKSMALLINT(ENOTSOCK) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2347
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2348
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2349
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2350
#ifdef EDESTADDRREQ
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2351
    if (sym == @symbol(EDESTADDRREQ)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2352
	RETURN ( __MKSMALLINT(EDESTADDRREQ) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2353
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2354
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2355
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2356
#ifdef EMSGSIZE
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2357
    if (sym == @symbol(EMSGSIZE)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2358
	RETURN ( __MKSMALLINT(EMSGSIZE) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2359
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2360
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2361
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2362
#ifdef EPROTOTYPE
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2363
    if (sym == @symbol(EPROTOTYPE)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2364
	RETURN ( __MKSMALLINT(EPROTOTYPE) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2365
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2366
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2367
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2368
#ifdef ENOPROTOOPT
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2369
    if (sym == @symbol(ENOPROTOOPT)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2370
	RETURN ( __MKSMALLINT(ENOPROTOOPT) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2371
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2372
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2373
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2374
#ifdef EPROTONOSUPPORT
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2375
    if (sym == @symbol(EPROTONOSUPPORT)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2376
	RETURN ( __MKSMALLINT(EPROTONOSUPPORT) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2377
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2378
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2379
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2380
#ifdef ESOCKTNOSUPPORT
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2381
    if (sym == @symbol(ESOCKTNOSUPPORT)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2382
	RETURN ( __MKSMALLINT(ESOCKTNOSUPPORT) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2383
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2384
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2385
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2386
#ifdef EOPNOTSUPP
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2387
    if (sym == @symbol(EOPNOTSUPP)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2388
	RETURN ( __MKSMALLINT(EOPNOTSUPP) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2389
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2390
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2391
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2392
#ifdef EPFNOSUPPORT
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2393
    if (sym == @symbol(EPFNOSUPPORT)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2394
	RETURN ( __MKSMALLINT(EPFNOSUPPORT) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2395
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2396
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2397
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2398
#ifdef EAFNOSUPPORT
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2399
    if (sym == @symbol(EAFNOSUPPORT)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2400
	RETURN ( __MKSMALLINT(EAFNOSUPPORT) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2401
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2402
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2403
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2404
#ifdef EADDRINUSE
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2405
    if (sym == @symbol(EADDRINUSE)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2406
	RETURN ( __MKSMALLINT(EADDRINUSE) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2407
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2408
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2409
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2410
#ifdef EADDRNOTAVAIL
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2411
    if (sym == @symbol(EADDRNOTAVAIL)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2412
	RETURN ( __MKSMALLINT(EADDRNOTAVAIL) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2413
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2414
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2415
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2416
#ifdef ETIMEDOUT
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2417
    if (sym == @symbol(ETIMEDOUT)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2418
	RETURN ( __MKSMALLINT(ETIMEDOUT) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2419
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2420
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2421
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2422
#ifdef ECONNREFUSED
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2423
    if (sym == @symbol(ECONNREFUSED)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2424
	RETURN ( __MKSMALLINT(ECONNREFUSED) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2425
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2426
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2427
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2428
#ifdef ENETDOWN
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2429
    if (sym == @symbol(ENETDOWN)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2430
	RETURN ( __MKSMALLINT(ENETDOWN) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2431
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2432
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2433
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2434
#ifdef ENETUNREACH
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2435
    if (sym == @symbol(ENETUNREACH)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2436
	RETURN ( __MKSMALLINT(ENETUNREACH) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2437
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2438
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2439
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2440
#ifdef ENETRESET
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2441
    if (sym == @symbol(ENETRESET)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2442
	RETURN ( __MKSMALLINT(ENETRESET) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2443
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2444
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2445
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2446
#ifdef ECONNABORTED
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2447
    if (sym == @symbol(ECONNABORTED)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2448
	RETURN ( __MKSMALLINT(ECONNABORTED) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2449
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2450
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2451
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2452
#ifdef ECONNRESET
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2453
    if (sym == @symbol(ECONNRESET)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2454
	RETURN ( __MKSMALLINT(ECONNRESET) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2455
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2456
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2457
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2458
#ifdef EISCONN
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2459
    if (sym == @symbol(EISCONN)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2460
	RETURN ( __MKSMALLINT(EISCONN) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2461
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2462
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2463
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2464
#ifdef ENOTCONN
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2465
    if (sym == @symbol(ENOTCONN)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2466
	RETURN ( __MKSMALLINT(ENOTCONN) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2467
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2468
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2469
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2470
#ifdef ESHUTDOWN
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2471
    if (sym == @symbol(ESHUTDOWN)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2472
	RETURN ( __MKSMALLINT(ESHUTDOWN) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2473
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2474
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2475
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2476
#ifdef EHOSTDOWN
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2477
    if (sym == @symbol(EHOSTDOWN)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2478
	RETURN ( __MKSMALLINT(EHOSTDOWN) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2479
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2480
#endif
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2481
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2482
#ifdef EHOSTUNREACH
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2483
    if (sym == @symbol(EHOSTUNREACH)) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2484
	RETURN ( __MKSMALLINT(EHOSTUNREACH) );
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2485
    }
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2486
#endif
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  2487
    /*
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  2488
     * VMS errors
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  2489
     */
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  2490
#ifdef EVMSERR
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  2491
    if (sym == @symbol(EVMSERR)) {
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  2492
	RETURN ( __MKSMALLINT(EVMSERR) );
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  2493
    }
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  2494
#endif
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  2495
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2496
%}.
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2497
    ^ -1
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2498
!
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2499
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2500
errorSymbolAndTextForNumber:errNr
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2501
    "return an array consisting of symbol &  message string from a unix errorNumber 
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2502
     (as returned by a system call). 
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2503
     The returned message is in english (as found in /usr/include/errno.h)
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2504
     and should be replaced by a resource lookup before being presented to the user."
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2505
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2506
    |sym text|
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2507
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2508
%{
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2509
    /* claus:
2871
e1acda461aa0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
  2510
     * I made this primitive code, since errnos are not
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2511
     * standard across unixes
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2512
     */
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2513
    char *msg = "unknown error";
2871
e1acda461aa0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
  2514
    char buffer[128];
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2515
    OBJ eno = errNr;
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2516
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1104
diff changeset
  2517
    if (__isSmallInteger(eno)) {
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  2518
	switch (__intVal(eno)) {
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2519
	    /*
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2520
	     * POSIX errnos - these should be defined
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2521
	     */
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2522
#ifdef EPERM
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2523
	    case EPERM:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2524
		msg = "Operation not permitted";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2525
		sym = @symbol(EPERM);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2526
		break;
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2527
#endif
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2528
#ifdef ENOENT
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2529
	    case ENOENT:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2530
		msg = "No such file or directory";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2531
		sym = @symbol(ENOENT);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2532
		break;
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2533
#endif
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2534
#ifdef ESRCH
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2535
	    case ESRCH:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2536
		msg = "No such process";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2537
		sym = @symbol(ESRCH);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2538
		break;
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2539
#endif
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2540
#ifdef EINTR
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2541
	    case EINTR:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2542
		msg = "Interrupted system call";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2543
		sym = @symbol(EINTR);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2544
		break;
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2545
#endif
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2546
#ifdef EIO
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2547
	    case EIO:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2548
		msg = "I/O error";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2549
		sym = @symbol(EIO);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2550
		break;
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2551
#endif
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2552
#ifdef ENXIO
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2553
	    case ENXIO:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2554
		msg = "No such device or address";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2555
		sym = @symbol(ENXIO);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2556
		break;
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2557
#endif
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2558
#ifdef E2BIG
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2559
	    case E2BIG:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2560
		msg = "Arg list too long";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2561
		sym = @symbol(E2BIG);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2562
		break;
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2563
#endif
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2564
#ifdef ENOEXEC
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2565
	    case ENOEXEC:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2566
		msg = "Exec format error";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2567
		sym = @symbol(ENOEXEC);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2568
		break;
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2569
#endif
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2570
#ifdef EBADF
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2571
	    case EBADF:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2572
		msg = "Bad file number";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2573
		sym = @symbol(EBADF);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2574
		break;
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2575
#endif
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2576
#ifdef ECHILD
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2577
	    case ECHILD:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2578
		msg = "No child processes";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2579
		sym = @symbol(ECHILD);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2580
		break;
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2581
#endif
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2582
#if !defined(EWOULDBLOCK) && defined(EAGAIN) && (EWOULDBLOCK != EAGAIN)
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2583
	    case EAGAIN:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2584
		msg = "Try again";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2585
		sym = @symbol(EAGAIN);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2586
		break;
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2587
#endif
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2588
#ifdef ENOMEM
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2589
	    case ENOMEM:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2590
		msg = "Out of memory";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2591
		sym = @symbol(ENOMEM);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2592
		break;
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2593
#endif
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2594
#ifdef EACCES
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2595
	    case EACCES:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2596
		msg = "Permission denied";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2597
		sym = @symbol(EACCES);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2598
		break;
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2599
#endif
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2600
#ifdef EFAULT
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2601
	    case EFAULT:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2602
		msg = "Bad address";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2603
		sym = @symbol(EFAULT);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2604
		break;
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2605
#endif
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2606
#ifdef EBUSY
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2607
	    case EBUSY:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2608
		msg = "Device or resource busy";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2609
		sym = @symbol(EBUSY);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2610
		break;
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2611
#endif
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2612
#ifdef EEXIST
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2613
	    case EEXIST:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2614
		msg = "File exists";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2615
		sym = @symbol(EEXIST);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2616
		break;
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2617
#endif
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2618
#ifdef EXDEV
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2619
	    case EXDEV:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2620
		msg = "Cross-device link";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2621
		sym = @symbol(EXDEV);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2622
		break;
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2623
#endif
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2624
#ifdef ENODEV
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2625
	    case ENODEV:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2626
		msg = "No such device";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2627
		sym = @symbol(ENODEV);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2628
		break;
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2629
#endif
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2630
#ifdef ENOTDIR
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2631
	    case ENOTDIR:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2632
		msg = "Not a directory";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2633
		sym = @symbol(ENOTDIR);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2634
		break;
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2635
#endif
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2636
#ifdef EISDIR
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2637
	    case EISDIR:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2638
		msg = "Is a directory";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2639
		sym = @symbol(EISDIR);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2640
		break;
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2641
#endif
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2642
#ifdef EINVAL
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2643
	    case EINVAL:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2644
		msg = "Invalid argument";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2645
		sym = @symbol(EINVAL);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2646
		break;
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2647
#endif
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2648
#ifdef ENFILE
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2649
	    case ENFILE:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2650
		msg = "File table overflow";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2651
		sym = @symbol(ENFILE);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2652
		break;
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2653
#endif
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2654
#ifdef EMFILE
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2655
	    case EMFILE:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2656
		msg = "Too many open files";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2657
		sym = @symbol(EMFILE);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2658
		break;
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2659
#endif
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2660
#ifdef ENOTTY
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2661
	    case ENOTTY:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2662
		msg = "Not a typewriter";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2663
		sym = @symbol(ENOTTY);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2664
		break;
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2665
#endif
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2666
#ifdef EFBIG
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2667
	    case EFBIG:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2668
		msg = "File too large";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2669
		sym = @symbol(EFBIG);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2670
		break;
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2671
#endif
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2672
#ifdef ENOSPC
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2673
	    case ENOSPC:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2674
		msg = "No space left on device";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2675
		sym = @symbol(ENOSPC);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2676
		break;
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2677
#endif
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2678
#ifdef ESPIPE
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2679
	    case ESPIPE:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2680
		msg = "Illegal seek";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2681
		sym = @symbol(ESPIPE);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2682
		break;
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2683
#endif
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2684
#ifdef EROFS
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2685
	    case EROFS:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2686
		msg = "Read-only file system";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2687
		sym = @symbol(EROFS);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2688
		break;
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2689
#endif
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2690
#ifdef EMLINK
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2691
	    case EMLINK:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2692
		msg = "Too many links";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2693
		sym = @symbol(EMLINK);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2694
		break;
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2695
#endif
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2696
#ifdef EPIPE
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2697
	    case EPIPE:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2698
		msg = "Broken pipe";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2699
		sym = @symbol(EPIPE);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2700
		break;
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2701
#endif
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2702
#ifdef EDOM
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2703
	    case EDOM:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2704
		msg = "Math argument out of domain";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2705
		sym = @symbol(EDOM);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2706
		break;
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2707
#endif
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2708
#ifdef ERANGE
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2709
	    case ERANGE:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2710
		msg = "Math result not representable";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2711
		sym = @symbol(ERANGE);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2712
		break;
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  2713
#endif
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2714
#ifdef EDEADLK
308
f04744ef7b5d *** empty log message ***
claus
parents: 300
diff changeset
  2715
# if EDEADLK != EWOULDBLOCK
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2716
	    case EDEADLK:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2717
		msg = "Resource deadlock would occur";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2718
		sym = @symbol(EDEADLK);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2719
		break;
308
f04744ef7b5d *** empty log message ***
claus
parents: 300
diff changeset
  2720
# endif
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2721
#endif
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2722
#ifdef ENAMETOOLONG
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2723
	    case ENAMETOOLONG:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2724
		msg = "File name too long";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2725
		sym = @symbol(ENAMETOOLONG);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2726
		break;
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2727
#endif
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2728
#ifdef ENOLCK
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2729
	    case ENOLCK:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2730
		msg = "No record locks available";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2731
		sym = @symbol(ENOLCK);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2732
		break;
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2733
#endif
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2734
#ifdef ENOSYS
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2735
	    case ENOSYS:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2736
		msg = "Function not implemented";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2737
		sym = @symbol(ENOSYS);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2738
		break;
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2739
#endif
359
claus
parents: 357
diff changeset
  2740
#if defined(ENOTEMPTY) && (ENOTEMPTY != EEXIST)
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2741
	    case ENOTEMPTY:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2742
		msg = "Directory not empty";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2743
		sym = @symbol(ENOTEMPTY);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2744
		break;
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2745
#endif
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2746
#ifdef EILSEQ
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2747
	    case EILSEQ:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2748
		msg = "Illegal byte sequence";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2749
		sym = @symbol(EILSEQ);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2750
		break;
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2751
#endif
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2752
	    /*
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2753
	     * XPG3 errnos - defined on most systems
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2754
	     */
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2755
#ifdef ENOTBLK
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2756
	    case ENOTBLK:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2757
		msg = "Block device required";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2758
		sym = @symbol(ENOTBLK);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2759
		break;
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2760
#endif
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2761
#ifdef ETXTBSY
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2762
	    case ETXTBSY:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2763
		msg = "Text file busy";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2764
		sym = @symbol(ETXTBSY);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2765
		break;
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2766
#endif
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2767
	    /*
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2768
	     * some others
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2769
	     */
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2770
#ifdef EWOULDBLOCK
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2771
	    case EWOULDBLOCK:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2772
		msg = "Operation would block";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2773
		sym = @symbol(EWOULDBLOCK);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2774
		break;
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2775
#endif
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2776
#ifdef ENOMSG
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2777
	    case ENOMSG:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2778
		msg = "No message of desired type";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2779
		sym = @symbol(ENOMSG);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2780
		break;
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2781
#endif
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2782
#ifdef ELOOP
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2783
	    case ELOOP:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2784
		msg = "Too many levels of symbolic links";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2785
		sym = @symbol(ELOOP);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2786
		break;
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2787
#endif
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2788
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2789
	    /*
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2790
	     * some stream errors
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2791
	     */
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2792
#ifdef ETIME
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2793
	    case ETIME:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2794
		msg = "Timer expired";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2795
		sym = @symbol(ETIME);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2796
		break;
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2797
#endif
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2798
#ifdef ENOSR
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2799
	    case ENOSR:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2800
		msg = "Out of streams resources";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2801
		sym = @symbol(ENOSR);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2802
		break;
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2803
#endif
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2804
#ifdef ENOSTR
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2805
	    case ENOSTR:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2806
		msg = "Device not a stream";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2807
		sym = @symbol(ENOSTR);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2808
		break;
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2809
#endif
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2810
#ifdef ECOMM
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2811
	    case ECOMM:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2812
		msg = "Communication error on send";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2813
		sym = @symbol(ECOMM);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2814
		break;
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2815
#endif
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2816
#ifdef EPROTO
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2817
	    case EPROTO:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2818
		msg = "Protocol error";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2819
		sym = @symbol(EPROTO);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2820
		break;
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2821
#endif
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2822
	    /*
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2823
	     * nfs errors
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2824
	     */
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2825
#ifdef ESTALE
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2826
	    case ESTALE:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2827
		msg = "Stale NFS file handle";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2828
		sym = @symbol(ESTALE);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2829
		break;
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2830
#endif
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2831
#ifdef EREMOTE
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2832
	    case EREMOTE:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2833
		msg = "Too many levels of remote in path";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2834
		sym = @symbol(EREMOTE);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2835
		break;
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2836
#endif
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2837
	    /*
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2838
	     * some networking errors
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2839
	     */
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2840
#ifdef EINPROGRESS
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2841
	    case EINPROGRESS:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2842
		msg = "Operation now in progress";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2843
		sym = @symbol(EINPROGRESS);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2844
		break;
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2845
#endif
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2846
#ifdef EALREADY
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2847
	    case EALREADY:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2848
		msg = "Operation already in progress";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2849
		sym = @symbol(EALREADY);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2850
		break;
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2851
#endif
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2852
#ifdef ENOTSOCK
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2853
	    case ENOTSOCK:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2854
		msg = "Socket operation on non-socket";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2855
		sym = @symbol(ENOTSOCK);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2856
		break;
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2857
#endif
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2858
#ifdef EDESTADDRREQ
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2859
	    case EDESTADDRREQ:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2860
		msg = "Destination address required";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2861
		sym = @symbol(EDESTADDRREQ);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2862
		break;
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2863
#endif
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2864
#ifdef EMSGSIZE
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2865
	    case EMSGSIZE:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2866
		msg = "Message too long";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2867
		sym = @symbol(EMSGSIZE);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2868
		break;
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2869
#endif
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2870
#ifdef EPROTOTYPE
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2871
	    case EPROTOTYPE:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2872
		msg = "Protocol wrong type for socket";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2873
		sym = @symbol(EPROTOTYPE);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2874
		break;
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2875
#endif
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2876
#ifdef ENOPROTOOPT
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2877
	    case ENOPROTOOPT:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2878
		msg = "Protocol not available";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2879
		sym = @symbol(ENOPROTOOPT);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2880
		break;
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2881
#endif
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2882
#ifdef EPROTONOSUPPORT
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2883
	    case EPROTONOSUPPORT:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2884
		msg = "Protocol not supported";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2885
		sym = @symbol(EPROTONOSUPPORT);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2886
		break;
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2887
#endif
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2888
#ifdef ESOCKTNOSUPPORT
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2889
	    case ESOCKTNOSUPPORT:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2890
		msg = "Socket type not supported";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2891
		sym = @symbol(ESOCKTNOSUPPORT);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2892
		break;
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2893
#endif
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2894
#ifdef EOPNOTSUPP
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2895
	    case EOPNOTSUPP:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2896
		msg = "Operation not supported on socket";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2897
		sym = @symbol(EOPNOTSUPP);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2898
		break;
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2899
#endif
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2900
#ifdef EPFNOSUPPORT
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2901
	    case EPFNOSUPPORT:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2902
		msg = "Protocol family not supported";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2903
		sym = @symbol(EPFNOSUPPORT);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2904
		break;
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2905
#endif
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2906
#ifdef EAFNOSUPPORT
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2907
	    case EAFNOSUPPORT:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2908
		msg = "Address family not supported by protocol family";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2909
		sym = @symbol(EAFNOSUPPORT);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2910
		break;
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2911
#endif
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2912
#ifdef EADDRINUSE
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2913
	    case EADDRINUSE:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2914
		msg = "Address already in use";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2915
		sym = @symbol(EADDRINUSE);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2916
		break;
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2917
#endif
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2918
#ifdef EADDRNOTAVAIL
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2919
	    case EADDRNOTAVAIL:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2920
		msg = "Can\'t assign requested address";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2921
		sym = @symbol(EADDRNOTAVAIL);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2922
		break;
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2923
#endif
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2924
#ifdef ETIMEDOUT
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2925
	    case ETIMEDOUT:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2926
		msg = "Connection timed out";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2927
		sym = @symbol(ETIMEDOUT);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2928
		break;
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2929
#endif
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2930
#ifdef ECONNREFUSED
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2931
	    case ECONNREFUSED:
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2932
		msg = "Connection refused";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2933
		sym = @symbol(ECONNREFUSED);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  2934
		break;
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  2935
#endif
362
claus
parents: 359
diff changeset
  2936
#ifdef ENETDOWN
claus
parents: 359
diff changeset
  2937
	    case ENETDOWN:
claus
parents: 359
diff changeset
  2938
		msg = "Network is down";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2939
		sym = @symbol(ENETDOWN);
362
claus
parents: 359
diff changeset
  2940
		break;
claus
parents: 359
diff changeset
  2941
#endif
claus
parents: 359
diff changeset
  2942
#ifdef ENETUNREACH
claus
parents: 359
diff changeset
  2943
	    case ENETUNREACH:
claus
parents: 359
diff changeset
  2944
		msg = "Network is unreachable";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2945
		sym = @symbol(ENETUNREACH);
362
claus
parents: 359
diff changeset
  2946
		break;
claus
parents: 359
diff changeset
  2947
#endif
claus
parents: 359
diff changeset
  2948
#ifdef ENETRESET
claus
parents: 359
diff changeset
  2949
	    case ENETRESET:
claus
parents: 359
diff changeset
  2950
		msg = "Network dropped conn due to reset";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2951
		sym = @symbol(ENETRESET);
362
claus
parents: 359
diff changeset
  2952
		break;
claus
parents: 359
diff changeset
  2953
#endif
claus
parents: 359
diff changeset
  2954
#ifdef ECONNABORTED
claus
parents: 359
diff changeset
  2955
	    case ECONNABORTED:
claus
parents: 359
diff changeset
  2956
		msg = "Software caused connection abort";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2957
		sym = @symbol(ECONNABORTED);
362
claus
parents: 359
diff changeset
  2958
		break;
claus
parents: 359
diff changeset
  2959
#endif
claus
parents: 359
diff changeset
  2960
#ifdef ECONNRESET
claus
parents: 359
diff changeset
  2961
	    case ECONNRESET:
claus
parents: 359
diff changeset
  2962
		msg = "Connection reset by peer";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2963
		sym = @symbol(ECONNRESET);
362
claus
parents: 359
diff changeset
  2964
		break;
claus
parents: 359
diff changeset
  2965
#endif
claus
parents: 359
diff changeset
  2966
#ifdef EISCONN
claus
parents: 359
diff changeset
  2967
	    case EISCONN:
claus
parents: 359
diff changeset
  2968
		msg = "Socket is already connected";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2969
		sym = @symbol(EISCONN);
362
claus
parents: 359
diff changeset
  2970
		break;
claus
parents: 359
diff changeset
  2971
#endif
claus
parents: 359
diff changeset
  2972
#ifdef ENOTCONN
claus
parents: 359
diff changeset
  2973
	    case ENOTCONN:
claus
parents: 359
diff changeset
  2974
		msg = "Socket is not connected";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2975
		sym = @symbol(ENOTCONN);
362
claus
parents: 359
diff changeset
  2976
		break;
claus
parents: 359
diff changeset
  2977
#endif
claus
parents: 359
diff changeset
  2978
#ifdef ESHUTDOWN
claus
parents: 359
diff changeset
  2979
	    case ESHUTDOWN:
claus
parents: 359
diff changeset
  2980
		msg = "Can't send after socket shutdown";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2981
		sym = @symbol(ESHUTDOWN);
362
claus
parents: 359
diff changeset
  2982
		break;
claus
parents: 359
diff changeset
  2983
#endif
claus
parents: 359
diff changeset
  2984
#ifdef EHOSTDOWN
claus
parents: 359
diff changeset
  2985
	    case EHOSTDOWN:
claus
parents: 359
diff changeset
  2986
		msg = "Host is down";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2987
		sym = @symbol(EHOSTDOWN);
362
claus
parents: 359
diff changeset
  2988
		break;
claus
parents: 359
diff changeset
  2989
#endif
claus
parents: 359
diff changeset
  2990
#ifdef EHOSTUNREACH
claus
parents: 359
diff changeset
  2991
	    case EHOSTUNREACH:
claus
parents: 359
diff changeset
  2992
		msg = "No route to host";
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  2993
		sym = @symbol(EHOSTUNREACH);
362
claus
parents: 359
diff changeset
  2994
		break;
claus
parents: 359
diff changeset
  2995
#endif
claus
parents: 359
diff changeset
  2996
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  2997
#ifdef WIN32
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  2998
	    /*
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  2999
	     * WIN32 GetLastError returns
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3000
	     */
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3001
# ifdef ERROR_FILE_NOT_FOUND
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3002
	    case WIN32_ERR(ERROR_FILE_NOT_FOUND):
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3003
		msg = "File not found";
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3004
		sym = @symbol(ERROR_FILE_NOT_FOUND);
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3005
		break;
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3006
# endif
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3007
# ifdef ERROR_BROKEN_PIPE
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3008
	    case WIN32_ERR(ERROR_BROKEN_PIPE):
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3009
		msg = "Broken pipe";
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3010
		sym = @symbol(ERROR_BROKEN_PIPE);
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3011
		break;
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3012
# endif
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3013
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3014
#endif /* WINM32 */
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3015
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3016
#ifdef __VMS__
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3017
# ifdef EVMSERR
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3018
	    case EVMSERR:
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3019
		msg = "VMS system request error";
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3020
		sym = @symbol(EVMSERR);
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3021
		break;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3022
# endif
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3023
#endif
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3024
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  3025
	    default:
368
a3c21a89ec37 *** empty log message ***
claus
parents: 362
diff changeset
  3026
		{
809
5eef87c2907b e convenient macro for register saving (sparc only)
Claus Gittinger <cg@exept.de>
parents: 805
diff changeset
  3027
		    __BEGIN_PROTECT_REGISTERS__
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  3028
		    sprintf(buffer, "ErrorNr: %d", __intVal(eno));
809
5eef87c2907b e convenient macro for register saving (sparc only)
Claus Gittinger <cg@exept.de>
parents: 805
diff changeset
  3029
		    __END_PROTECT_REGISTERS__
368
a3c21a89ec37 *** empty log message ***
claus
parents: 362
diff changeset
  3030
		}
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  3031
		msg = buffer;
2871
e1acda461aa0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
  3032
		sym = @symbol(ERROR_OTHER);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  3033
		break;
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  3034
	}
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  3035
	text = __MKSTRING(msg);
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  3036
    } else {
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  3037
	text = nil;
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  3038
	sym = nil;
2871
e1acda461aa0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
  3039
    }
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  3040
%}.
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  3041
    ^ Array with:sym with:text
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  3042
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  3043
    "
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  3044
     OperatingSystem errorSymbolAndTextForNumber:4
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  3045
    "
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3046
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3047
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  3048
errorSymbolForNumber:errNr
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  3049
    "return a symbol for a unix errorNumber
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  3050
     (as returned by a system call)."
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  3051
1153
8119975c55ce Fix errorSymbolForNumber, add clearLastErrorNumber.
Stefan Vogel <sv@exept.de>
parents: 1142
diff changeset
  3052
    ^ (self errorSymbolAndTextForNumber:errNr) at:1
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  3053
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  3054
    "
1666
4797ec69fc53 comment
Claus Gittinger <cg@exept.de>
parents: 1654
diff changeset
  3055
     OperatingSystem errorSymbolForNumber:4
4797ec69fc53 comment
Claus Gittinger <cg@exept.de>
parents: 1654
diff changeset
  3056
     OperatingSystem errorSymbolForNumber:2
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  3057
    "
1153
8119975c55ce Fix errorSymbolForNumber, add clearLastErrorNumber.
Stefan Vogel <sv@exept.de>
parents: 1142
diff changeset
  3058
8119975c55ce Fix errorSymbolForNumber, add clearLastErrorNumber.
Stefan Vogel <sv@exept.de>
parents: 1142
diff changeset
  3059
    "Modified: 12.4.1996 / 09:16:29 / stefan"
1666
4797ec69fc53 comment
Claus Gittinger <cg@exept.de>
parents: 1654
diff changeset
  3060
    "Modified: 13.9.1996 / 16:23:35 / cg"
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  3061
!
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  3062
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  3063
errorTextForNumber:errNr
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  3064
    "return a message string from a unix errorNumber 
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  3065
     (as returned by a system call). 
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  3066
     The returned message is in english (as found in /usr/include/errno.h)
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  3067
     and should be replaced by a resource lookup before being presented to the user."
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  3068
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  3069
    ^ (self errorSymbolAndTextForNumber:errNr) at:2
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  3070
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  3071
    "
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  3072
     OperatingSystem errorTextForNumber:4
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  3073
    "
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  3074
!
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  3075
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3076
lastErrorNumber
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  3077
    "return the last errors number.
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  3078
     See also: #lastErrorSymbol and #lastErrorString.
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  3079
     Notice: having a single error number is a bad idea in a multithreaded
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3080
	     environment - this interface will change."
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3081
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3082
    ^ LastErrorNumber
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3083
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3084
     "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3085
      OperatingSystem lastErrorNumber
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3086
     "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3087
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3088
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  3089
lastErrorString
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  3090
    "return a message string describing the last error.
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  3091
     See also: #lastErrorNumber and #lastErrorSymbol.
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  3092
     Notice: having a single error number is a bad idea in a multithreaded
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3093
	     environment - this interface will change."
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  3094
2871
e1acda461aa0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
  3095
    LastErrorNumber isNil ifTrue:[^ nil].
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  3096
    ^ self errorTextForNumber:LastErrorNumber
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  3097
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  3098
    "
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  3099
     OperatingSystem lastErrorString
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  3100
    "
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  3101
!
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  3102
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  3103
lastErrorSymbol
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  3104
    "return a symbol (such as #EBADF or #EACCESS) describing the last error.
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  3105
     See also: #lastErrorNumber and #lastErrorString.
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  3106
     Notice: having a single error number is a bad idea in a multithreaded
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3107
	     environment - this interface will change."
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  3108
2871
e1acda461aa0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
  3109
    LastErrorNumber isNil ifTrue:[^ nil].
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  3110
    ^ self errorSymbolForNumber:LastErrorNumber
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  3111
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  3112
    "
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  3113
     OperatingSystem lastErrorSymbol
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  3114
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3115
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3116
1799
0a2c5890f4f3 handle 'foo///' in directoryName
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  3117
!OperatingSystem class methodsFor:'executing OS commands'!
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3118
2975
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  3119
getVMSSymbol:aSymbolString
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  3120
    "get a symbols value, or nil if there is none"
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  3121
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  3122
    |p l i1 i2|
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  3123
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  3124
    p := PipeStream readingFrom:'sho sym ' , aSymbolString.
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  3125
    p notNil ifTrue:[
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  3126
	l := p nextLIne.
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  3127
	p close.
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  3128
    ].
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  3129
    l notNil ifTrue:[
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  3130
	i1 := l indexOf:$".
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  3131
	i1 ~~ 0 ifTrue:[
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  3132
	    i2 := l lastIndexOf:$".
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  3133
	    (i2 ~~ 0 and:[i2 > i1]) ifTrue:[
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  3134
		^ l copyFrom:i1+1 to:i2-1
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  3135
	    ]
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  3136
	].
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  3137
    ].
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  3138
    ^ nil
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  3139
!
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  3140
    
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3141
canExecuteCommand:aCommandString
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3142
    "return true, if the OS can execute aCommand.
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3143
     For now, this only works with UNIX."
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3144
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3145
    |cmd|
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3146
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3147
    cmd := aCommandString asCollectionOfWords first.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3148
    ^ (self pathOfCommand:cmd) notNil
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3149
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3150
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3151
     OperatingSystem canExecuteCommand:'fooBar'  
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3152
     OperatingSystem canExecuteCommand:'ls'  
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3153
     OperatingSystem canExecuteCommand:'cvs'  
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3154
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3155
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3156
    "Created: 4.11.1995 / 19:13:54 / cg"
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  3157
!
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  3158
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3159
commandAndArgsForOSCommand:aCommandString
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3160
    "get a shell and shell arguments for command execution"
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3161
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3162
    |shell args wDir|
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3163
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3164
    self isMSWINDOWSlike ifTrue:[
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3165
	"/
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3166
	"/ 'x:\WINNT\System32\cmd /c <command>'
2619
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  3167
	"/ or 'x:\WINDOWS\System32\cmd /c <command>'
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  3168
	"/ or 'x:\WINDOWS\System\cmd /c <command>'
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  3169
	"/ or whatever ...
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3170
	"/
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3171
	wDir := self getWindowsSystemDirectory asFilename.
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3172
	shell := (wDir construct:'cmd') pathName , ' /c'.
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3173
	args := aCommandString.
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3174
    ] ifFalse:[
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3175
	self isVMSlike ifTrue:[
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3176
	    shell := ''.        "/ always DCL
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3177
	    args := aCommandString.
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3178
	] ifFalse:[
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3179
	    "/
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3180
	    "/ '/bin/sh -c <command>'
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3181
	    "/
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3182
	    shell := '/bin/sh'.
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3183
	    args := Array with:'sh' with:'-c' with:aCommandString.
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3184
	]
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3185
    ].
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3186
    ^ Array with:shell with:args
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3187
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3188
    "Modified: 2.5.1997 / 11:56:36 / cg"
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3189
!
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3190
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3191
exec:aCommandPath withArguments:argArray
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3192
    "execute the unix command specified by the argument, aCommandPath, with
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3193
     arguments in argArray (no arguments, if nil).
771
1ad3f852e201 merged fork/exec into one, in order to use vfork
Claus Gittinger <cg@exept.de>
parents: 766
diff changeset
  3194
     If successful, this method does NOT return and smalltalk is gone.
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3195
     If not successful, it does return. 
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3196
     Can be used on UNIX with fork or on other systems to chain to another program."
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3197
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3198
    self exec:aCommandPath withArguments:argArray fork:false
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3199
!
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3200
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3201
exec:aCommandPath withArguments:argArray fileDescriptors:fdArray closeDescriptors:closeFdArray fork:doFork newPgrp:newPgrp
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3202
    "Internal lowLevel entry for combined fork & exec;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3203
     If fork is false (chain a command):
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3204
	 execute the OS command specified by the argument, aCommandPath, with
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3205
	 arguments in argArray (no arguments, if nil).
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3206
	 If successful, this method does not return and smalltalk is gone.
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3207
	 If not successful, it does return. 
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3208
	 Normal use is with forkForCommand.
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3209
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3210
     If fork is true (subprocess command execution):
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3211
	fork a child to do the above.
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3212
	The process id of the child process is returned; nil if the fork failed.
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3213
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3214
     fdArray contains the filedescriptors, to be used for the child (if fork is true).
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3215
	fdArray[1] = 15 -> use fd 15 as stdin.
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3216
	If an element of the array is set to nil, the corresponding filedescriptor
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3217
	will be closed for the child.
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3218
	fdArray[0] == StdIn for child
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3219
	fdArray[1] == StdOut for child
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3220
	fdArray[2] == StdErr for child
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3221
	on VMS, these must be channels as returned by createMailBox.
1062
baa5827a7a40 Do not transparently restart system calls after a (Unix-)signal.
Stefan Vogel <sv@exept.de>
parents: 1060
diff changeset
  3222
baa5827a7a40 Do not transparently restart system calls after a (Unix-)signal.
Stefan Vogel <sv@exept.de>
parents: 1060
diff changeset
  3223
     closeFdArray contains descriptors that will be closed in the subprocess.
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3224
	closeDescriptors are ignored in the WIN32 & VMS versions.
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3225
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3226
     NOTE that in WIN32 the fds are HANDLES!!
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3227
1280
b7ae6227f48b Allow setting of process group in exec:....
Stefan Vogel <sv@exept.de>
parents: 1247
diff changeset
  3228
     If newPgrp is true, the subprocess will be established in a new process group.
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3229
	The processgroup will be equal to id.
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3230
	newPgrp is not used on WIN32 and VMS systems.
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3231
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3232
     Notice: this used to be two separate ST-methods; however, in order to use
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3233
	    vfork on some machines, it had to be merged into one, to avoid write
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3234
	    accesses to ST/X memory from the vforked-child. 
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3235
	    The code below only does read accesses."
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3236
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3237
    |channelIn channelOut mbxName_in mbxName_out|
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3238
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3239
    self isVMSlike ifTrue:[
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3240
	fdArray notNil ifTrue:[
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3241
	    (channelIn := fdArray at:1) notNil ifTrue:[
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3242
		mbxName_in := self mailBoxNameOf:channelIn.
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3243
	    ].
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3244
	    (channelOut := fdArray at:2) notNil ifTrue:[
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3245
		mbxName_out := self mailBoxNameOf:channelOut.
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3246
	    ].
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3247
	]
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3248
    ].
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3249
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3250
%{  /* STACK: 16000 */
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3251
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3252
#if !defined(MSDOS_LIKE) && !defined(__VMS__)
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3253
    char **argv;
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3254
    int nargs, i, id;
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3255
    OBJ arg;
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3256
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3257
    if (__isString(aCommandPath) && 
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3258
	((argArray == nil) || __isArray(argArray)) &&
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3259
	((fdArray == nil) || __isArray(fdArray)) &&
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3260
	((closeFdArray == nil) || __isArray(closeFdArray))
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3261
    ) {
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3262
	nargs = argArray == nil ? 0 : _arraySize(argArray);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3263
	argv = (char **) malloc(sizeof(char *) * (nargs + 1));
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3264
	if (argv) {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3265
	    for (i=0; i < nargs; i++) {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3266
		arg = __ArrayInstPtr(argArray)->a_element[i];
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3267
		if (__isString(arg)) {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3268
		    argv[i] = (char *) __stringVal(arg);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3269
		} else {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3270
		    argv[i] = "";
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3271
		}
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3272
	    }
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3273
	    argv[i] = NULL;
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3274
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3275
	    if (doFork == true) {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3276
		int nfd, nclose;
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3277
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3278
		nfd = fdArray == nil ? 0 : _arraySize(fdArray);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3279
		nclose = closeFdArray == nil ? 0 : _arraySize(closeFdArray);
2619
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  3280
# ifdef HAS_VFORK
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3281
		id = vfork();
2619
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  3282
# else
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3283
		id = fork();
2619
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  3284
# endif
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3285
		if (id == 0) {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3286
		    /*
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3287
		    ** In child.
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3288
		    ** first: dup filedescriptors
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3289
		    */
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3290
		    for (i = 0; i < nfd; i++) {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3291
			if (__isSmallInteger(__ArrayInstPtr(fdArray)->a_element[i]) &&
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3292
			    __intVal(__ArrayInstPtr(fdArray)->a_element[i]) != i
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3293
			) {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3294
			    dup2(__intVal(__ArrayInstPtr(fdArray)->a_element[i]), i);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3295
			}
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3296
		    }
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3297
		    /*
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3298
		    ** second: close unused filedescriptors
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3299
		    */
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3300
		    for (i = 0; i < nfd; i++) {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3301
			if (__ArrayInstPtr(fdArray)->a_element[i] == nil) {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3302
			    close(i);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3303
			}
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3304
		    }
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3305
		    /*
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3306
		    ** third: close filedescriptors
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3307
		    */
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3308
		    for (i = 0; i < nclose; i++) {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3309
			if (__isSmallInteger(__ArrayInstPtr(closeFdArray)->a_element[i])) {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3310
			    close(__intVal(__ArrayInstPtr(closeFdArray)->a_element[i]));
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3311
			}
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3312
		    }
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3313
		    if (newPgrp == true) {
2619
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  3314
# if defined(_POSIX_JOB_CONTROL)
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3315
			(void) setpgid(0, 0);
2619
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  3316
# else
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  3317
#  if defined(BSD)
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3318
			(void) setpgrp(0);
2619
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  3319
#  endif
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  3320
# endif
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3321
		    }
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3322
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3323
		    execv(__stringVal(aCommandPath), argv);
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3324
		    /* should not be reached */
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3325
		    _exit(127);                 /* POSIX 2 compatible exit value */
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3326
		}
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3327
		/*
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3328
		** In parent: succes or failure
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3329
		*/
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3330
		free(argv);
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  3331
		if (id == -1) {
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  3332
		    RETURN (nil);
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  3333
		} else {
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  3334
		    RETURN (__MKSMALLINT(id));
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  3335
		}
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3336
	    } else {
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3337
		execv(__stringVal(aCommandPath), argv);
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3338
		/* 
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3339
		 * should not be reached
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3340
		 * (well, it is, if you pass a wrong command-path)
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3341
		 */
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3342
		free(argv);
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3343
		RETURN ( nil );
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3344
	    }
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3345
	}
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3346
    }
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  3347
#else /* WIN32 or VMS */
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3348
# ifdef __VMS__
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3349
    /*
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3350
     * if fork is false, chain to another command (not yet supported)
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3351
     * otherwise, spawn a subprocess and let it execute the command.
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3352
     * Currently, only the forking version is supported (who chains anyway ?)
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3353
     * Only stdIn & stdOut are allowed in fdArray;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3354
     */
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3355
    char fullCmdLine[1024];
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3356
    char cliBuffer[1024];
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3357
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3358
    if (__isString(aCommandPath) && __isString(argArray)){
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3359
	struct dsc$descriptor_s cmddsc, clidsc, in_mbxdsc, out_mbxdsc;
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3360
	int status;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3361
	static struct Vstring in_mbxname, out_mbxname;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3362
	int in_channel, out_channel;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3363
	int flags;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3364
	struct procInfo *pInfo;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3365
	char *cli = (char *)0;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3366
	extern void __vms_ASTChildWithInfo();
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3367
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3368
	if (__isSmallInteger(channelIn)) {
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3369
	    in_channel = __intVal(channelIn);
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3370
	} else {
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3371
	    in_channel = 0;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3372
	}
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3373
	if (__isSmallInteger(channelOut)) {
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3374
	    out_channel = __intVal(channelOut);
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3375
	} else {
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3376
	    out_channel = 0;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3377
	}
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3378
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3379
	/*
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3380
	 * generate command line & cli line
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3381
	 */
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3382
	if (aCommandPath && (strlen(__stringVal(aCommandPath)) > 0)) {
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3383
	    strcpy( cliBuffer, __stringVal(aCommandPath) );
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3384
	    if (cliBuffer[0]) {
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3385
		cli = cliBuffer;
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3386
	    }
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3387
	}
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3388
	strcpy( fullCmdLine, __stringVal(argArray) );
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3389
#ifdef PROCESSDEBUG
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3390
	printf("DCL command: <%s>\n", fullCmdLine);
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3391
#endif
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3392
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3393
	/*
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3394
	 * get the mailBox names for in & out
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3395
	 */
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3396
	if (__isString(mbxName_in)) {
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3397
	    strcpy(in_mbxname.body, __stringVal(mbxName_in));
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3398
	    in_mbxname.length = strlen(__stringVal(mbxName_in));
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3399
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3400
#ifdef PROCESSDEBUG
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3401
	    printf("DCL input: <%s>\n", __stringVal(mbxName_in));
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3402
#endif
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3403
	    /* Build descriptors for in & out */
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3404
	    in_mbxdsc.dsc$w_length  = in_mbxname.length;
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3405
	    in_mbxdsc.dsc$b_dtype   = DSC$K_DTYPE_T;
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3406
	    in_mbxdsc.dsc$b_class   = DSC$K_CLASS_S;
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3407
	    in_mbxdsc.dsc$a_pointer = in_mbxname.body;
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3408
	}
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3409
	if (__isString(mbxName_out)) {
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3410
	    strcpy(out_mbxname.body, __stringVal(mbxName_out));
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3411
	    out_mbxname.length = strlen(__stringVal(mbxName_out));
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3412
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3413
#ifdef PROCESSDEBUG
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3414
	    printf("DCL output: <%s>\n", __stringVal(mbxName_out));
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3415
#endif
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3416
	    out_mbxdsc.dsc$w_length  = out_mbxname.length;
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3417
	    out_mbxdsc.dsc$b_dtype   = DSC$K_DTYPE_T;
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3418
	    out_mbxdsc.dsc$b_class   = DSC$K_CLASS_S;
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3419
	    out_mbxdsc.dsc$a_pointer = out_mbxname.body;
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3420
	}
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3421
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3422
	/* 
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3423
	 * Build descriptor for command line
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3424
	 */
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3425
	cmddsc.dsc$w_length  = strlen(fullCmdLine);
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3426
	cmddsc.dsc$b_dtype   = DSC$K_DTYPE_T;
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3427
	cmddsc.dsc$b_class   = DSC$K_CLASS_S;
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3428
	cmddsc.dsc$a_pointer = fullCmdLine;
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3429
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3430
	/*
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3431
	 * optional cli descriptor
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3432
	 */
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3433
	if (cli) {
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3434
	    clidsc.dsc$w_length  = strlen(cli);
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3435
	    clidsc.dsc$b_dtype   = DSC$K_DTYPE_T;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3436
	    clidsc.dsc$b_class   = DSC$K_CLASS_S;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3437
	    clidsc.dsc$a_pointer = cli;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3438
	}
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3439
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3440
	flags = CLI$M_NOWAIT;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3441
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3442
	if (doFork == true) {
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3443
#ifdef NOTDEF
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3444
	    /* 
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3445
	     * Allocate an event flag to signal process termination
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3446
	     */
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3447
	    status = LIB$GET_EF(&siop->event_flag);
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3448
	    if (status != SS$_NORMAL) {
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3449
		vaxc$errno = status;
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3450
		errno = EVMSERR;
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3451
		if (in_channel) SYS$DASSGN(in_channel);
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3452
		if (out_channel) SYS$DASSGN(out_channel);
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3453
		fprintf(stderr, "OperatingSystem [warning]: LIB$GET_EF failed\n");
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3454
		RETURN (nil);
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3455
	    }
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3456
#endif
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3457
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3458
	    /*
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3459
	     * get a new procInfo struct
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3460
	     */
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3461
	    {
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3462
		pInfo = procInfoFree;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3463
		if (pInfo) {
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3464
		    procInfoFree = pInfo->nextProc;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3465
		} else {
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3466
		    pInfo = (struct procInfo *)malloc(sizeof(struct procInfo));
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3467
		}
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3468
	    }
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3469
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3470
	    pInfo->finished = 0;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3471
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3472
	    pInfo->nextProc = procInfoHead;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3473
	    procInfoHead = pInfo;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3474
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3475
#ifdef PROCESSDEBUG
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3476
	    printf("spawn pInfo=%x\n", pInfo);
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3477
#endif
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3478
	    /*
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3479
	     * now, spawn
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3480
	     */
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3481
	    status = LIB$SPAWN(&cmddsc,
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3482
			       (in_channel ? &in_mbxdsc : 0),
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3483
			       (out_channel ? &out_mbxdsc : 0),
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3484
			       &flags,
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3485
			       0,               /* process name */
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3486
			       &(pInfo->pid),
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3487
			       &(pInfo->returnStatus), 
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3488
			       &procEventFlag,
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3489
			       __vms_ASTChildWithInfo,
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3490
			       pInfo,           /* AST argument */
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3491
			       0,               /* prompt */
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3492
			       (cli ? &clidsc : 0)
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3493
			      );
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3494
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3495
	    if (status != SS$_NORMAL) {
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3496
		procInfoHead = pInfo->nextProc;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3497
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3498
		pInfo->nextProc = procInfoFree;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3499
		procInfoFree = pInfo;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3500
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3501
		vaxc$errno = status;
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3502
		errno = EVMSERR;
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3503
		if (in_channel) SYS$DASSGN(in_channel);
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3504
		if (out_channel) SYS$DASSGN(out_channel);
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3505
		fprintf(stderr, "OperatingSystem [warning]: LIB$SPAWN failed: %d\n", status);
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3506
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3507
		RETURN (nil);
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3508
	    }
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3509
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3510
#ifdef PROCESSDEBUG
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3511
	    printf("pid = %d\n", pInfo->pid);
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3512
#endif
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3513
	    /*
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3514
	     * got the pid ...
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3515
	     */
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3516
	    RETURN (__MKUINT(pInfo->pid));
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3517
	} else {
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3518
	    /* should never be called that way ... */
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3519
	}
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3520
    }
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3521
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3522
# else
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3523
#  ifdef WIN32
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3524
    /*
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3525
     * if fork is false, chain to another command (not yet supported)
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3526
     * otherwise, spawn a subprocess and let it execute the command.
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3527
     * Currently, only the forking version is supported (who chains anyway ?)
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3528
     */
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3529
    char fullCmdLine[1024];
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3530
    int   id = -1;
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3531
    DWORD               fdwCreate = 0;
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3532
    STARTUPINFO         lpsiStartInfo;
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3533
    PROCESS_INFORMATION lppiProcInfo;
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3534
    SECURITY_ATTRIBUTES process, thread;
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3535
 
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3536
    if (__isString(aCommandPath) && __isString(argArray)){
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3537
	/*
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3538
	 * generate command line (cmd plus args)
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3539
	 */
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3540
	strcpy( fullCmdLine, __stringVal(aCommandPath) );
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3541
	strcat( fullCmdLine, " ");
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3542
	strcat( fullCmdLine, __stringVal(argArray) );
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3543
 
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3544
	/*
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3545
	 * create descriptors as req'd
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3546
	 */
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3547
	process.nLength = sizeof( process );
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3548
	process.lpSecurityDescriptor = NULL;
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3549
	process.bInheritHandle = TRUE;
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3550
 
2599
e9d0af498464 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  3551
	thread.nLength = sizeof( thread ); 
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3552
	thread.lpSecurityDescriptor = NULL; 
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3553
	thread.bInheritHandle = TRUE;
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3554
 
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3555
	lpsiStartInfo.cb                = sizeof(PROCESS_INFORMATION);
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3556
	lpsiStartInfo.lpReserved        = NULL;
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3557
	lpsiStartInfo.lpDesktop         = NULL;
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3558
	lpsiStartInfo.lpTitle           = NULL;
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3559
	lpsiStartInfo.dwX               = 0;
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3560
	lpsiStartInfo.dwY               = 0;
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3561
	lpsiStartInfo.dwXSize           = 100;
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3562
	lpsiStartInfo.dwYSize           = 100;
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3563
	lpsiStartInfo.dwXCountChars     = 0;
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3564
	lpsiStartInfo.dwYCountChars     = 0;
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3565
	lpsiStartInfo.dwFillAttribute   = 0;
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3566
	lpsiStartInfo.dwFlags           = 0;
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3567
	lpsiStartInfo.wShowWindow       = 0;
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3568
	lpsiStartInfo.cbReserved2       = 0;
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3569
	lpsiStartInfo.lpReserved2       = NULL;
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3570
	lpsiStartInfo.hStdInput         = NULL;
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3571
	lpsiStartInfo.hStdOutput        = NULL;
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3572
	lpsiStartInfo.hStdError         = NULL;
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3573
 
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3574
	/* set create process flags */
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3575
	fdwCreate = NORMAL_PRIORITY_CLASS | STARTF_USESTDHANDLES | STARTF_USEPOSITION;
2599
e9d0af498464 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  3576
	if( newPgrp == true ) {
e9d0af498464 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  3577
	    fdwCreate |= CREATE_NEW_PROCESS_GROUP;
e9d0af498464 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  3578
	}
e9d0af498464 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  3579
e9d0af498464 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  3580
	if( ( fdArray != nil ) 
e9d0af498464 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  3581
	 && __isArray(fdArray)
2602
074f99294753 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2600
diff changeset
  3582
	 && ( __arraySize(fdArray) == 3 ) ) {
2599
e9d0af498464 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  3583
	    if (__isExternalAddress(__ArrayInstPtr(fdArray)->a_element[0]) ) {
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3584
		lpsiStartInfo.hStdInput  = _HANDLEVal(__ArrayInstPtr(fdArray)->a_element[0]);
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3585
/*
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3586
		printf( "Set StdInput %d\n", _HANDLEVal(__ArrayInstPtr(fdArray)->a_element[0]) );
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3587
*/
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3588
	    }
2599
e9d0af498464 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  3589
	    if (__isExternalAddress(__ArrayInstPtr(fdArray)->a_element[1]) ) {
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3590
		lpsiStartInfo.hStdOutput = _HANDLEVal(__ArrayInstPtr(fdArray)->a_element[1]);
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3591
/*
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3592
		printf( "Set StdOutput %d\n", _HANDLEVal(__ArrayInstPtr(fdArray)->a_element[1]) );
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3593
*/
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3594
	    }
2599
e9d0af498464 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  3595
	    if (__isExternalAddress(__ArrayInstPtr(fdArray)->a_element[2]) ) {
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3596
		lpsiStartInfo.hStdError  = _HANDLEVal(__ArrayInstPtr(fdArray)->a_element[2]);
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3597
/*
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3598
		printf( "Set Stderror %d\n", _HANDLEVal(__ArrayInstPtr(fdArray)->a_element[2]) );
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3599
 */
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3600
	    }
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3601
	}
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3602
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3603
/*
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3604
	printf( "forking\n" );
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3605
*/
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3606
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3607
	if (doFork == true) {
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3608
	    if( CreateProcess(  NULL, 
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3609
				fullCmdLine,
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3610
				&process,
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3611
				&thread,
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3612
				TRUE,
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3613
				fdwCreate,
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3614
				NULL,
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3615
				NULL,
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3616
				&lpsiStartInfo,
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3617
				&lppiProcInfo ) )
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3618
	    {
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3619
		id = lppiProcInfo.dwProcessId;
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3620
		printf( "createrd process\n" );
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3621
	    }
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3622
	    if (id) {
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3623
		RETURN (__MKOBJ(id) );
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3624
	    }
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3625
	    RETURN (nil);
2599
e9d0af498464 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  3626
	} else {
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3627
	    ; /* should never be called that way */
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3628
	}
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3629
    }
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3630
#  endif /* WIN32 */
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3631
# endif /* VMS */
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3632
#endif /* UNIX */
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3633
%}.
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3634
    "
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3635
     path-argument not string
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3636
     or argArray not an array/nil
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3637
     or malloc failed
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3638
     or not supported by OS
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3639
    "
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3640
    ^ self primitiveFailed
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3641
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3642
    "
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3643
     |id|
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3644
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3645
     id := OperatingSystem fork.
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3646
     id == 0 ifTrue:[
2501
10e5faa8dafe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2496
diff changeset
  3647
	'I am the child'.
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  3648
	OperatingSystem exec:'/bin/ls' withArguments:#('ls' '/tmp').
2501
10e5faa8dafe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2496
diff changeset
  3649
	'not reached'.
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3650
     ]
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3651
    "
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3652
    "
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3653
     |id|
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3654
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3655
     id := OperatingSystem fork.
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3656
     id == 0 ifTrue:[
2501
10e5faa8dafe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2496
diff changeset
  3657
	'I am the child'.
2619
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  3658
	OperatingSystem 
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  3659
	   exec:'/bin/sh' 
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  3660
	   withArguments:#('sh' '-c' 'sleep 2;echo 1;sleep 2;echo 2').
2501
10e5faa8dafe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2496
diff changeset
  3661
	'not reached'.
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3662
     ].
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3663
     id printNL.
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3664
     (Delay forSeconds:3.5) wait.
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3665
     'killing ...' printNL.
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3666
     OperatingSystem sendSignal:(OperatingSystem sigTERM) to:id.
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3667
     OperatingSystem sendSignal:(OperatingSystem sigKILL) to:id
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3668
    "
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3669
!
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3670
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3671
exec:aCommandPath withArguments:argArray fork:doFork
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3672
    "execute an OS command without I/O redirection.
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3673
     The command reads its input and writes its output
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3674
     from/to whatever terminal device ST/X was started
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3675
     (typically, the xterm window)"
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3676
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3677
    ^ self exec:aCommandPath 
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3678
	   withArguments:argArray 
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3679
	   fileDescriptors:nil
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3680
	   closeDescriptors:nil 
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3681
	   fork:doFork 
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3682
	   newPgrp:false
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3683
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3684
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3685
     |id|
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3686
771
1ad3f852e201 merged fork/exec into one, in order to use vfork
Claus Gittinger <cg@exept.de>
parents: 766
diff changeset
  3687
     id := OperatingSystem fork.
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3688
     id == 0 ifTrue:[
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3689
	'I am the child'.
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3690
	OperatingSystem 
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3691
	    exec:'/bin/ls' 
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3692
	    withArguments:#('ls' '/tmp')
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3693
	    fork:false.
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3694
	'not reached'.
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3695
     ]
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3696
    "
2619
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  3697
670
4d6d0c031711 startProcess: / killProcess: added
Claus Gittinger <cg@exept.de>
parents: 640
diff changeset
  3698
    "
4d6d0c031711 startProcess: / killProcess: added
Claus Gittinger <cg@exept.de>
parents: 640
diff changeset
  3699
     |id|
4d6d0c031711 startProcess: / killProcess: added
Claus Gittinger <cg@exept.de>
parents: 640
diff changeset
  3700
771
1ad3f852e201 merged fork/exec into one, in order to use vfork
Claus Gittinger <cg@exept.de>
parents: 766
diff changeset
  3701
     id := OperatingSystem fork.
670
4d6d0c031711 startProcess: / killProcess: added
Claus Gittinger <cg@exept.de>
parents: 640
diff changeset
  3702
     id == 0 ifTrue:[
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3703
	'I am the child'.
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3704
	OperatingSystem 
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3705
	    exec:'/bin/sh' 
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3706
	    withArguments:#('sh' '-c' 'sleep 2;echo 1;sleep 2;echo 2')
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3707
	    fork:false.
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3708
	'not reached'.
670
4d6d0c031711 startProcess: / killProcess: added
Claus Gittinger <cg@exept.de>
parents: 640
diff changeset
  3709
     ].
4d6d0c031711 startProcess: / killProcess: added
Claus Gittinger <cg@exept.de>
parents: 640
diff changeset
  3710
     id printNL.
4d6d0c031711 startProcess: / killProcess: added
Claus Gittinger <cg@exept.de>
parents: 640
diff changeset
  3711
     (Delay forSeconds:3.5) wait.
4d6d0c031711 startProcess: / killProcess: added
Claus Gittinger <cg@exept.de>
parents: 640
diff changeset
  3712
     'killing ...' printNL.
4d6d0c031711 startProcess: / killProcess: added
Claus Gittinger <cg@exept.de>
parents: 640
diff changeset
  3713
     OperatingSystem sendSignal:(OperatingSystem sigTERM) to:id.
4d6d0c031711 startProcess: / killProcess: added
Claus Gittinger <cg@exept.de>
parents: 640
diff changeset
  3714
     OperatingSystem sendSignal:(OperatingSystem sigKILL) to:id
4d6d0c031711 startProcess: / killProcess: added
Claus Gittinger <cg@exept.de>
parents: 640
diff changeset
  3715
    "
2756
474469f24fe8 #exec:withArguments... should return nil instead of -1 if fork()
Stefan Vogel <sv@exept.de>
parents: 2755
diff changeset
  3716
474469f24fe8 #exec:withArguments... should return nil instead of -1 if fork()
Stefan Vogel <sv@exept.de>
parents: 2755
diff changeset
  3717
    "Modified: 15.7.1997 / 15:54:32 / stefan"
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3718
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3719
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3720
executeCommand:aCommandString
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3721
    "execute the unix command specified by the argument, aCommandString.
676
4aa4417c103c commentary
Claus Gittinger <cg@exept.de>
parents: 675
diff changeset
  3722
     The commandString is passed to a shell for execution - see the description of
4aa4417c103c commentary
Claus Gittinger <cg@exept.de>
parents: 675
diff changeset
  3723
     'sh -c' in your UNIX manual.
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3724
     Return true if successful, false otherwise."
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3725
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3726
     ^ self 
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3727
	executeCommand:aCommandString 
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3728
	onError:[:status| false]
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3729
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3730
    "unix:
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3731
805
850571f0255f WANT_SYSTEM for unixware.
Stefan Vogel <sv@exept.de>
parents: 803
diff changeset
  3732
     OperatingSystem executeCommand:'sleep 30'. 
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3733
     OperatingSystem executeCommand:'pwd'. 
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3734
     OperatingSystem executeCommand:'ls -l'. 
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3735
     OperatingSystem executeCommand:'invalidCommand'. 
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3736
     OperatingSystem executeCommand:'rm /tmp/foofoofoofoo'. 
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3737
    "
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3738
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3739
    "msdos:
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3740
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3741
     OperatingSystem executeCommand:'dir' 
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3742
     OperatingSystem executeCommand:'dir /w'
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3743
    "
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3744
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3745
    "vms:
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3746
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3747
     OperatingSystem executeCommand:'dir'
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3748
     OperatingSystem executeCommand:'purge'
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3749
     OperatingSystem executeCommand:'cc foo.c'
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3750
    "
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3751
2080
d93d4af439d7 Use #executeCommand:onError: to implement #executeCommand:.
Stefan Vogel <sv@exept.de>
parents: 2073
diff changeset
  3752
    "Modified: 7.1.1997 / 19:29:55 / stefan"
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3753
    "Modified: 2.5.1997 / 12:27:39 / cg"
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3754
!
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3755
2976
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  3756
executeCommand:aCommandString inDirectory:aDirectory
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  3757
    "much like #executeCommand:, but changes the current directory
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  3758
     for the command. Since this is OS specific, use this instead of
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  3759
     hardwiring any 'cd ..' command strings into your applictions."
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  3760
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  3761
    |tmpComFile cmd ret|
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  3762
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  3763
    (self platformName == #vms) ifTrue:[
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3764
	tmpComFile := OperatingSystem createCOMFileForVMSCommand:aCommandString in:aDirectory.
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3765
	cmd := '@' , tmpComFile osName.
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3766
	[
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3767
	    ret := self executeCommand:cmd.
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3768
	] valueNowOrOnUnwindDo:[
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3769
	    tmpComFile delete.
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3770
	].
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  3771
	^ ret
2976
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  3772
    ].
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  3773
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  3774
    "/ unix - prepend a 'cd' to the command
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  3775
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  3776
    cmd := 'cd ' , aDirectory asFilename pathName, '; ' , aCommandString.
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  3777
    ^ self executeCommand:cmd
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  3778
!
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  3779
1885
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  3780
executeCommand:aCommandString inputFrom:anExternalInStream outputTo:anExternalOutStream errorTo:anExternalErrStream onError:aBlock
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  3781
    "execute the unix command specified by the argument, aCommandString.
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  3782
     The commandString is passed to a shell for execution - see the description of
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  3783
     'sh -c' in your UNIX manual.
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  3784
     Return true if successful.
2571
7e26d9e69ba6 comments
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  3785
     If not successfull, aBlock is called with an OsProcessStatus
7e26d9e69ba6 comments
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  3786
     (containing the exit status) as argument."
1885
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  3787
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  3788
    |pid exitStatus sema|
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  3789
2266
a94af740c68a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
  3790
    sema := Semaphore new name:'Unix command wait'.
1885
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  3791
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3792
    pid := Processor 
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3793
		monitor:[
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3794
		    self 
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3795
			startProcess:aCommandString
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3796
			inputFrom:anExternalInStream 
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3797
			outputTo:anExternalOutStream 
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3798
			errorTo:anExternalErrStream.
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3799
		] 
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3800
		action:[:status |
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3801
		    status stillAlive ifFalse:[
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3802
			exitStatus := status.
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3803
			sema signal
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3804
		    ].
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3805
		].
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  3806
    pid notNil ifTrue:[
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3807
	sema wait.
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  3808
    ] ifFalse:[
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3809
	exitStatus := OSProcessStatus processCreationFailure.
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  3810
    ].
1885
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  3811
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  3812
    exitStatus success ifFalse:[
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3813
	^ aBlock value:exitStatus
1885
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  3814
    ].
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  3815
    ^ true.
2266
a94af740c68a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
  3816
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  3817
    "Modified: 25.3.1997 / 11:02:02 / stefan"
2571
7e26d9e69ba6 comments
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  3818
    "Modified: 19.4.1997 / 18:15:04 / cg"
1885
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  3819
!
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  3820
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3821
executeCommand:aCommandString onError:aBlock
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3822
    "execute the unix command specified by the argument, aCommandString.
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3823
     The commandString is passed to a shell for execution - see the description of
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3824
     'sh -c' in your UNIX manual.
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3825
     Return true if successful.
2571
7e26d9e69ba6 comments
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  3826
     If not successfull, aBlock is called with an OsProcessStatus
7e26d9e69ba6 comments
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  3827
     (containing the exit status) as argument."
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3828
1034
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  3829
    |pid exitStatus sema|
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3830
2949
6993ad758a9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
  3831
    sema := Semaphore new name:'OS command wait'.
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3832
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3833
    pid := Processor 
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3834
		monitor:[self startProcess:aCommandString] 
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3835
		action:[:status |
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3836
			status stillAlive ifFalse:[
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3837
			    exitStatus := status.
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3838
			    sema signal
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3839
			].
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3840
		].
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  3841
    pid notNil ifTrue:[
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3842
	sema wait.
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  3843
    ] ifFalse:[
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3844
	exitStatus := OSProcessStatus processCreationFailure.
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  3845
    ].
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3846
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3847
    exitStatus success ifFalse:[
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  3848
	^ aBlock value:exitStatus
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3849
    ].
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3850
    ^ true.
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3851
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3852
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3853
    "
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3854
     OperatingSystem executeCommand:'sleep 30' onError:[]. 
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3855
     OperatingSystem executeCommand:'pwd' onError:[:status|status inspect]. 
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3856
     OperatingSystem executeCommand:'ls -l' onError:[]. 
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3857
     OperatingSystem executeCommand:'invalidCommand' onError:[:status| status inspect]. 
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3858
     OperatingSystem executeCommand:'rm /tmp/foofoofoofoo'onError:[:status | status inspect]. 
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3859
    "
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3860
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  3861
    "Created: 22.12.1995 / 14:49:59 / stefan"
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  3862
    "Modified: 25.3.1997 / 11:06:43 / stefan"
2571
7e26d9e69ba6 comments
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  3863
    "Modified: 19.4.1997 / 18:14:41 / cg"
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3864
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3865
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3866
fork
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3867
    "fork a new (HEAVY-weight) unix process.
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3868
     Not supported with MSDOS & VMS systems.
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3869
     Dont confuse this with Block>>fork, which creates 
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3870
     lightweight smalltalk processes. This method will return
676
4aa4417c103c commentary
Claus Gittinger <cg@exept.de>
parents: 675
diff changeset
  3871
     0 to the child process, and a non-zero number (which is the childs
4aa4417c103c commentary
Claus Gittinger <cg@exept.de>
parents: 675
diff changeset
  3872
     unix-process-id) to the parent (original) process.
764
eadba1b6a721 vfork interface (for poor BSD ultrix) - without it, it takes 20 seconds
Claus Gittinger <cg@exept.de>
parents: 763
diff changeset
  3873
676
4aa4417c103c commentary
Claus Gittinger <cg@exept.de>
parents: 675
diff changeset
  3874
     In normal situations, you dont need to use this low level entry; see
771
1ad3f852e201 merged fork/exec into one, in order to use vfork
Claus Gittinger <cg@exept.de>
parents: 766
diff changeset
  3875
     #startProcess: and #executCommand: for higher level interfaces."
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  3876
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  3877
%{  /* NOCONTEXT */
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3878
#if !defined(MSDOS_LIKE) && !defined(__VMS__)
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3879
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3880
    int pid;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3881
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3882
    pid = fork();
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3883
    RETURN ( __MKUINT(pid) );
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3884
#endif
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3885
%}.
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  3886
    "/
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  3887
    "/ not supported by OS
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  3888
    "/
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3889
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3890
    ^ UnsupportedOperationSignal raise
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  3891
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3892
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3893
     |id|
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3894
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3895
     id := OperatingSystem fork.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3896
     id == 0 ifTrue:[
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3897
	OperatingSystem exit
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3898
     ]
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  3899
    "
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  3900
!
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  3901
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3902
getStatusOfProcess:aProcessId
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3903
    "wait for a process to terminate and fetch its exit status.
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3904
     This is required to avoid zombie processes."
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3905
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3906
%{
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3907
#ifndef MSDOS_LIKE
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3908
    int status;
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3909
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3910
    if (__isSmallInteger(aProcessId)) {
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3911
	pid_t pid = (pid_t)(__intVal(aProcessId));
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3912
	{
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3913
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3914
# ifdef  NO_WAITPID
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3915
	    pid_t child;
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3916
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3917
	    do {
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3918
		__BEGIN_INTERRUPTABLE__
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3919
		child = __wait (&status);
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3920
		__END_INTERRUPTABLE__
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3921
		if (child < 0 && errno != EINTR) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  3922
		    fprintf(stderr, "OS: child-wait errno=%d\n", errno);
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3923
		    status = -1;
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3924
		    break;
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3925
		}
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3926
	    } while (child != pid);
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3927
# else
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3928
	    pid_t child;
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3929
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3930
	    /* claus: the original did not care for EINTR here ... */
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3931
	    do {
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3932
		__BEGIN_INTERRUPTABLE__
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3933
		child = __waitpid (pid, &status, 0);
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3934
		__END_INTERRUPTABLE__
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3935
	    } while ((child != pid) && (errno == EINTR));
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3936
	    if (child != pid) {
1058
5d010b97ecb8 added methods to handle symbolic errno codes
Claus Gittinger <cg@exept.de>
parents: 1046
diff changeset
  3937
		fprintf(stderr, "OS: child-waitpid errno=%d\n", errno);
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3938
		status = -1;
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3939
	    }
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3940
# endif /* NO_WAITPID */
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3941
	}
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3942
	RETURN ( __MKSMALLINT(status));
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3943
    }
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3944
#endif
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3945
%}.
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3946
    self primitiveFailed
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  3947
1034
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  3948
!
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  3949
2834
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  3950
nameOfSTXExecutable
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  3951
    "return the name of the running ST/X executable program.
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  3952
     Usually, 'stx' is returned - but may be different for
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  3953
     standAlone apps."
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  3954
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  3955
%{
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  3956
    extern char *__stxExecutableName__();
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  3957
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  3958
    RETURN (__MKSTRING(__stxExecutableName__()));
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  3959
%}
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  3960
    "
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  3961
     OperatingSystem nameOfSTXExecutable
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  3962
    "
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  3963
!
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  3964
1034
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  3965
pathOfCommand:aCommand
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3966
    "find where aCommand's executable file is;
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3967
     return its full pathName if there is such a command, otherwise
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3968
     return nil."
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3969
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  3970
    |path f fExt|
1034
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  3971
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3972
    aCommand asFilename isAbsolute ifTrue:[
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3973
	^ aCommand
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3974
    ].
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3975
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3976
    self isVMSlike ifTrue:[
2975
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  3977
	(self getVMSSymbol:aCommand) notNil ifTrue:[
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  3978
	    ^ aCommand
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  3979
	].
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3980
	^ nil
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3981
    ].
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  3982
1034
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  3983
    path := self getEnvironment:'PATH'.
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  3984
    path notNil ifTrue:[
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3985
	(path asCollectionOfSubstringsSeparatedBy:(self pathSeparator)) do:[:path |
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3986
	    path isEmpty ifTrue:[
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3987
		f := aCommand asFilename
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3988
	    ] ifFalse:[
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3989
		f := path asFilename construct:aCommand.
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3990
	    ].
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3991
	    self executableFileExtensions do:[:ext |
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3992
		ext notEmpty ifTrue:[
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3993
		    fExt := (f pathName , ext) asFilename.
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3994
		] ifFalse:[
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3995
		    fExt := f.
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3996
		].
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3997
		fExt isExecutable ifTrue:[
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3998
		    ^ fExt pathName
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  3999
		].
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4000
	    ].
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4001
	].
1034
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  4002
    ].
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  4003
    ^ nil
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  4004
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  4005
    "unix:
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  4006
1034
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  4007
     OperatingSystem pathOfCommand:'fooBar'  
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  4008
     OperatingSystem pathOfCommand:'ls'    
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  4009
     OperatingSystem pathOfCommand:'cvs'   
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4010
     OperatingSystem pathOfCommand:'stx'   
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  4011
    "
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  4012
    "windows:
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  4013
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  4014
     OperatingSystem pathOfCommand:'windbg'
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  4015
    "
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  4016
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4017
    "Modified: 24.7.1997 / 17:19:04 / cg"
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4018
!
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4019
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4020
pathOfSTXExecutable
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4021
    "return the full path of the running ST/X executable program.
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4022
     Usually, '/../../stx' is returned - but may be different for
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4023
     standAlone apps."
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4024
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4025
    ^ self pathOfCommand:(self nameOfSTXExecutable)
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4026
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4027
    "
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4028
     OperatingSystem pathOfSTXExecutable
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4029
    "
1034
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  4030
!
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  4031
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  4032
startProcess:aCommandString
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  4033
    "start executing the OS command as specified by the argument, aCommandString
1034
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  4034
     as a separate process; do not wait for the command to finish.
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  4035
     The commandString is passed to a shell for execution - see the description of
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  4036
     'sh -c' in your UNIX manual.
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  4037
     Return the processId if successful, nil otherwise.
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  4038
     Use #waitForProcess: for synchronization and exec status return,
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  4039
     or #killProcess: to stop it."
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  4040
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  4041
    |shellAndArgs|
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  4042
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  4043
    shellAndArgs := self commandAndArgsForOSCommand:aCommandString.
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  4044
    ^ self
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4045
	exec:(shellAndArgs at:1)
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4046
	withArguments:(shellAndArgs at:2)
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4047
	fork:true.
1034
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  4048
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  4049
    "
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  4050
     |pid|
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  4051
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  4052
     pid := OperatingSystem startProcess:'sleep 2; echo 1; sleep 2; echo 2'.
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  4053
     (Delay forSeconds:3) wait.
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  4054
     OperatingSystem killProcess:pid.
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  4055
    "
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  4056
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  4057
    "Modified: 21.3.1997 / 10:04:35 / dq"
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  4058
    "Modified: 2.5.1997 / 11:55:44 / cg"
1045
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4059
!
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4060
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4061
startProcess:aCommandString inputFrom:anExternalInStream outputTo:anExternalOutStream errorTo:anExternalErrStream
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  4062
    "start executing the OS command as specified by the argument, aCommandString
1045
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4063
     as a separate process; do not wait for the command to finish.
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4064
     The commandString is passed to a shell for execution - see the description of
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  4065
     'sh -c' in your UNIX manual ('cmd.com' in your MSDOS manual).
1045
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4066
     The command gets stdIn, stdOut and stdErr assigned from the arguments;
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4067
     each may be nil.
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4068
     Return the processId if successful, nil otherwise.
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4069
     Use #monitorPid:action: for synchronization and exec status return,
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4070
     or #killProcess: to stop it."
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4071
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  4072
    |in out err shellAndArgs|
1045
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4073
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4074
    anExternalInStream notNil ifTrue:[
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4075
	in := anExternalInStream fileDescriptor.
1046
7b50e6c3147f nil input -> /dev/null
ca
parents: 1045
diff changeset
  4076
    ] ifFalse:[
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4077
	self isUNIXlike ifTrue:[
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4078
	    in := '/dev/null' asFilename readStream fileDescriptor
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4079
	]
1045
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4080
    ].
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4081
    anExternalOutStream notNil ifTrue:[
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4082
	out := anExternalOutStream fileDescriptor.
1045
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4083
    ].
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4084
    anExternalErrStream notNil ifTrue:[
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4085
	err := anExternalErrStream fileDescriptor.
1045
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4086
    ].
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4087
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  4088
    shellAndArgs := self commandAndArgsForOSCommand:aCommandString.
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  4089
    ^ self
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4090
	exec:(shellAndArgs at:1)
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4091
	withArguments:(shellAndArgs at:2)
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4092
	fileDescriptors:(Array with:in with:out with:err)
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4093
	closeDescriptors:nil
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4094
	fork:true
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4095
	newPgrp:false.
1045
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4096
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4097
    "blocking at current prio (i.e. only higher prio threads execute):
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4098
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4099
     OperatingSystem executeCommand:'ls -l > out'.
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4100
    "
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4101
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4102
    "non-blocking (lower prio threads continue):
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4103
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4104
     |in out err pid sema|
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4105
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4106
     in := 'out' asFilename readStream.
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4107
     out := 'out2' asFilename writeStream.
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4108
     err := 'err' asFilename writeStream.
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4109
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4110
     sema := Semaphore new.
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4111
     pid := OperatingSystem startProcess:'sleep 10; grep drw' inputFrom:in outputTo:out errorTo:err.
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  4112
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  4113
     The following will no longer work. monitorPid has disappeared 
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  4114
1045
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4115
     pid notNil ifTrue:[
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4116
	 Processor monitorPid:pid action:[:OSstatus | sema signal ].
1045
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4117
     ].
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4118
     in close.
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4119
     out close.
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4120
     err close.
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4121
     sema wait.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1323
diff changeset
  4122
     Transcript showCR:'finished'
1045
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4123
    "
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4124
c7a38395a1d4 added user-friendly interface: #startProcess:inputFrom:outputTo:errorTo:
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
  4125
    "Created: 29.2.1996 / 12:31:29 / cg"
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  4126
    "Modified: 21.3.1997 / 10:04:35 / dq"
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  4127
    "Modified: 2.5.1997 / 12:18:20 / cg"
2756
474469f24fe8 #exec:withArguments... should return nil instead of -1 if fork()
Stefan Vogel <sv@exept.de>
parents: 2755
diff changeset
  4128
    "Modified: 15.7.1997 / 16:03:51 / stefan"
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4129
! !
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4130
1799
0a2c5890f4f3 handle 'foo///' in directoryName
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  4131
!OperatingSystem class methodsFor:'file access'!
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4132
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4133
closeFd:anInteger
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4134
    "low level close of a filedescriptor"
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4135
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4136
%{
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4137
#if !defined(transputer) && !defined(MSDOS_LIKE)
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4138
     if (__isSmallInteger(anInteger)) {
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4139
	close(__intVal(anInteger));
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4140
	RETURN(self);
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4141
     }
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  4142
#else
2599
e9d0af498464 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  4143
# if defined(MSDOS_LIKE)
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  4144
     if (__isExternalAddress(anInteger) ) {
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  4145
	if( !CloseHandle( anInteger ) ) {
2619
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  4146
	    fprintf( stderr, "Could not close handle : %d\n", anInteger);
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  4147
	}
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  4148
	RETURN(self);
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  4149
     }
2599
e9d0af498464 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  4150
# endif
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4151
#endif
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4152
%}.
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4153
     ^ self primitiveFailed.
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4154
!
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4155
2620
6fbb5b11586b mkdir no longer uses systemCommand
Claus Gittinger <cg@exept.de>
parents: 2619
diff changeset
  4156
createDirectory:aPathName
6fbb5b11586b mkdir no longer uses systemCommand
Claus Gittinger <cg@exept.de>
parents: 2619
diff changeset
  4157
    "create a new directory with name 'aPathName', which may be an absolute
6fbb5b11586b mkdir no longer uses systemCommand
Claus Gittinger <cg@exept.de>
parents: 2619
diff changeset
  4158
     path, or relative to the current directory.
6fbb5b11586b mkdir no longer uses systemCommand
Claus Gittinger <cg@exept.de>
parents: 2619
diff changeset
  4159
     Return true if successful (or the directory existed already), false if failed.
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4160
     This is a low-level entry - use Filename protocol for compatibility."
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4161
1497
92f5370f3942 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
  4162
    "/ if it already exists this is ok
92f5370f3942 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
  4163
2620
6fbb5b11586b mkdir no longer uses systemCommand
Claus Gittinger <cg@exept.de>
parents: 2619
diff changeset
  4164
    (self isDirectory:aPathName) ifTrue:[^ true].
6fbb5b11586b mkdir no longer uses systemCommand
Claus Gittinger <cg@exept.de>
parents: 2619
diff changeset
  4165
6fbb5b11586b mkdir no longer uses systemCommand
Claus Gittinger <cg@exept.de>
parents: 2619
diff changeset
  4166
%{
6fbb5b11586b mkdir no longer uses systemCommand
Claus Gittinger <cg@exept.de>
parents: 2619
diff changeset
  4167
    if (__isString(aPathName)) {
2621
Claus Gittinger <cg@exept.de>
parents: 2620
diff changeset
  4168
	int ret;
Claus Gittinger <cg@exept.de>
parents: 2620
diff changeset
  4169
2620
6fbb5b11586b mkdir no longer uses systemCommand
Claus Gittinger <cg@exept.de>
parents: 2619
diff changeset
  4170
#if defined(MSDOS_LIKE)
6fbb5b11586b mkdir no longer uses systemCommand
Claus Gittinger <cg@exept.de>
parents: 2619
diff changeset
  4171
	SECURITY_ATTRIBUTES sa;
6fbb5b11586b mkdir no longer uses systemCommand
Claus Gittinger <cg@exept.de>
parents: 2619
diff changeset
  4172
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4173
	sa.nLength = sizeof( sa );
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4174
	sa.lpSecurityDescriptor = NULL;
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4175
	sa.bInheritHandle = TRUE;
2620
6fbb5b11586b mkdir no longer uses systemCommand
Claus Gittinger <cg@exept.de>
parents: 2619
diff changeset
  4176
6fbb5b11586b mkdir no longer uses systemCommand
Claus Gittinger <cg@exept.de>
parents: 2619
diff changeset
  4177
	ret = CreateDirectory(__stringVal(aPathName), &sa);
6fbb5b11586b mkdir no longer uses systemCommand
Claus Gittinger <cg@exept.de>
parents: 2619
diff changeset
  4178
	if (ret != TRUE) {
6fbb5b11586b mkdir no longer uses systemCommand
Claus Gittinger <cg@exept.de>
parents: 2619
diff changeset
  4179
	    @global(LastErrorNumber) = __MKSMALLINT(WIN32_ERR(GetLastError()));
6fbb5b11586b mkdir no longer uses systemCommand
Claus Gittinger <cg@exept.de>
parents: 2619
diff changeset
  4180
	    RETURN (false);
6fbb5b11586b mkdir no longer uses systemCommand
Claus Gittinger <cg@exept.de>
parents: 2619
diff changeset
  4181
	}
6fbb5b11586b mkdir no longer uses systemCommand
Claus Gittinger <cg@exept.de>
parents: 2619
diff changeset
  4182
	RETURN (true);
6fbb5b11586b mkdir no longer uses systemCommand
Claus Gittinger <cg@exept.de>
parents: 2619
diff changeset
  4183
#else
6fbb5b11586b mkdir no longer uses systemCommand
Claus Gittinger <cg@exept.de>
parents: 2619
diff changeset
  4184
	ret = mkdir(__stringVal(aPathName), 0755);
6fbb5b11586b mkdir no longer uses systemCommand
Claus Gittinger <cg@exept.de>
parents: 2619
diff changeset
  4185
	if (ret < 0) {
6fbb5b11586b mkdir no longer uses systemCommand
Claus Gittinger <cg@exept.de>
parents: 2619
diff changeset
  4186
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
6fbb5b11586b mkdir no longer uses systemCommand
Claus Gittinger <cg@exept.de>
parents: 2619
diff changeset
  4187
	    RETURN (false);
6fbb5b11586b mkdir no longer uses systemCommand
Claus Gittinger <cg@exept.de>
parents: 2619
diff changeset
  4188
	}
6fbb5b11586b mkdir no longer uses systemCommand
Claus Gittinger <cg@exept.de>
parents: 2619
diff changeset
  4189
	RETURN (true);
6fbb5b11586b mkdir no longer uses systemCommand
Claus Gittinger <cg@exept.de>
parents: 2619
diff changeset
  4190
#endif
2621
Claus Gittinger <cg@exept.de>
parents: 2620
diff changeset
  4191
      }
Claus Gittinger <cg@exept.de>
parents: 2620
diff changeset
  4192
%}.
Claus Gittinger <cg@exept.de>
parents: 2620
diff changeset
  4193
2620
6fbb5b11586b mkdir no longer uses systemCommand
Claus Gittinger <cg@exept.de>
parents: 2619
diff changeset
  4194
"/    self isUNIXlike ifTrue:[
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4195
"/      ^ self executeCommand:('mkdir 2>/dev/null ', newPathName)
2620
6fbb5b11586b mkdir no longer uses systemCommand
Claus Gittinger <cg@exept.de>
parents: 2619
diff changeset
  4196
"/    ].
6fbb5b11586b mkdir no longer uses systemCommand
Claus Gittinger <cg@exept.de>
parents: 2619
diff changeset
  4197
"/    ^ self executeCommand:('mkdir ', newPathName)
6fbb5b11586b mkdir no longer uses systemCommand
Claus Gittinger <cg@exept.de>
parents: 2619
diff changeset
  4198
6fbb5b11586b mkdir no longer uses systemCommand
Claus Gittinger <cg@exept.de>
parents: 2619
diff changeset
  4199
    self primitiveFailed
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4200
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4201
    "
1497
92f5370f3942 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
  4202
     OperatingSystem createDirectory:'foo'  
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4203
    "
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4204
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4205
    "Modified: 20.12.1995 / 11:24:13 / stefan"
1497
92f5370f3942 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
  4206
    "Modified: 29.6.1996 / 14:06:54 / cg"
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4207
!
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4208
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4209
linkFile:oldPath to:newPath
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4210
    "link the file 'oldPath' to 'newPath'. The link will be a hard link.
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4211
     Return true if successful, false if not."
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4212
1104
219a06128193 removed NOCONTEXT directives ...
Claus Gittinger <cg@exept.de>
parents: 1084
diff changeset
  4213
%{
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4214
#if !defined(MSDOS_LIKE) && !defined(__VMS__)
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4215
    int ret;
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4216
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4217
    if (__isString(oldPath) && __isString(newPath)) {
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4218
	__BEGIN_INTERRUPTABLE__
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4219
	do {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4220
	    ret = link((char *) __stringVal(oldPath), (char *) __stringVal(newPath));
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4221
	} while (ret < 0 && errno == EINTR);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4222
	__END_INTERRUPTABLE__
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4223
	if (ret < 0) {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4224
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4225
	    RETURN ( false );
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4226
	}
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4227
	RETURN (true);
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4228
    }
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4229
#endif
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4230
%}.
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4231
    (oldPath isString not or:[newPath isString not]) ifTrue:[
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4232
	"/
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4233
	"/ bad argument(s) given
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4234
	"/
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4235
	^ self primitiveFailed 
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4236
    ].
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4237
2939
b7cebf237308 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2937
diff changeset
  4238
    "/
b7cebf237308 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2937
diff changeset
  4239
    "/ this OperatingSystem does not support links
b7cebf237308 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2937
diff changeset
  4240
    "/
b7cebf237308 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2937
diff changeset
  4241
    ^ UnsupportedOperationSignal raise
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4242
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4243
    "
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4244
     OperatingSystem linkFile:'foo' to:'bar'
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4245
    "
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4246
!
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4247
1132
b09ce8542506 checkin from browser
ca
parents: 1119
diff changeset
  4248
recursiveCopyDirectory:sourcePathName to:destination
b09ce8542506 checkin from browser
ca
parents: 1119
diff changeset
  4249
    "copy the directory named 'sourcePathName' and all contained files/directories to 'destination'.
b09ce8542506 checkin from browser
ca
parents: 1119
diff changeset
  4250
     Return true if successful."
b09ce8542506 checkin from browser
ca
parents: 1119
diff changeset
  4251
b09ce8542506 checkin from browser
ca
parents: 1119
diff changeset
  4252
    ^ self executeCommand:('cp -rf ' , sourcePathName, ' ', destination)
b09ce8542506 checkin from browser
ca
parents: 1119
diff changeset
  4253
b09ce8542506 checkin from browser
ca
parents: 1119
diff changeset
  4254
    "Modified: 7.3.1996 / 15:26:30 / cg"
b09ce8542506 checkin from browser
ca
parents: 1119
diff changeset
  4255
!
b09ce8542506 checkin from browser
ca
parents: 1119
diff changeset
  4256
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4257
recursiveCreateDirectory:dirName
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4258
    "create a directory - with all parent dirs if needed.
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4259
     Return true if successful, false otherwise. If false
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4260
     is returned, a partial created tree may be left,
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4261
     which is not cleaned-up here."
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4262
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4263
    self createDirectory:dirName.
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4264
    (self isDirectory:dirName) ifFalse:[
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  4265
	(self recursiveCreateDirectory:(dirName asFilename directoryName)) ifFalse:[^ false].
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4266
	^ self createDirectory:dirName
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4267
    ].
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4268
    ^ true
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4269
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4270
    "
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4271
     OperatingSystem recursiveCreateDirectory:'foo/bar/baz'
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4272
     OperatingSystem recursiveRemoveDirectory:'foo'
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4273
    "
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4274
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4275
    "Modified: 7.3.1996 / 15:26:22 / cg"
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4276
!
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4277
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4278
recursiveRemoveDirectory:fullPathName
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4279
    "remove the directory named 'fullPathName' and all contained files/directories.
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4280
     Return true if successful."
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4281
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  4282
    self isUNIXlike ifTrue:[
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4283
	^ self executeCommand:('rm -rf ' , fullPathName)
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  4284
    ].
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  4285
    ^ false.
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4286
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4287
    "
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4288
     OperatingSystem recursiveCreateDirectory:'foo/bar/baz'
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4289
     OperatingSystem recursiveRemoveDirectory:'foo'
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4290
    "
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4291
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4292
    "Modified: 7.3.1996 / 15:26:30 / cg"
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4293
!
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4294
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4295
removeDirectory:fullPathName
2620
6fbb5b11586b mkdir no longer uses systemCommand
Claus Gittinger <cg@exept.de>
parents: 2619
diff changeset
  4296
    "remove the directory named 'fullPathName'. 
6fbb5b11586b mkdir no longer uses systemCommand
Claus Gittinger <cg@exept.de>
parents: 2619
diff changeset
  4297
     The directory must be empty and you must have appropriate access rights.
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4298
     Return true if successful, false if directory is not empty or no permission.
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4299
     This is a lowLevel entry - use Filename protocol for compatibility."
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4300
1104
219a06128193 removed NOCONTEXT directives ...
Claus Gittinger <cg@exept.de>
parents: 1084
diff changeset
  4301
%{
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4302
    int ret;
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4303
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4304
    if (__isString(fullPathName)) {
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4305
#if !defined(MSDOS_LIKE) && !defined(__VMS__)
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4306
	__BEGIN_INTERRUPTABLE__
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4307
	do {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4308
	    ret = rmdir((char *) __stringVal(fullPathName));
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4309
	} while (ret < 0 && errno == EINTR);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4310
	__END_INTERRUPTABLE__
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4311
	if (ret < 0) {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4312
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4313
	    RETURN ( false );
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4314
	}
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4315
	RETURN (true);
2619
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  4316
#else
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  4317
# ifdef WIN32
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  4318
	ret = RemoveDirectory((char *) __stringVal(fullPathName));
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  4319
	if (ret != TRUE) {
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  4320
	    @global(LastErrorNumber) = __MKSMALLINT( WIN32_ERR(GetLastError()) );
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  4321
	    RETURN (false);
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  4322
	}
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  4323
	RETURN (true);
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  4324
# else
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  4325
#  if defined(HAS_REMOVE)
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  4326
	__BEGIN_INTERRUPTABLE__
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  4327
	do {
2959
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  4328
	    errno = 0;
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  4329
	    ret = remove((char *) __stringVal(fullPathName));
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  4330
	} while (ret < 0 && errno == EINTR);
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  4331
	__END_INTERRUPTABLE__
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  4332
	if (ret < 0) {
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  4333
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  4334
	    RETURN ( false );
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4335
	}
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4336
	RETURN (true);
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  4337
#  endif /* HAS_REMOVE */
2619
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  4338
# endif
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  4339
#endif
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4340
    }
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4341
%}.
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4342
    "/
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4343
    "/ either not a string argument,
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4344
    "/ or not supported by OS
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4345
    "/
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4346
    ^ self primitiveFailed
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4347
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4348
    "
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4349
     OperatingSystem createDirectory:'foo'
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4350
     OperatingSystem removeDirectory:'foo'
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4351
    "
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4352
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4353
!
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4354
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4355
removeFile:fullPathName
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4356
    "remove the file named 'fullPathName'; return true if successful.
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4357
     This is a lowLevel entry - use Filename protocol for compatibility."
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4358
1104
219a06128193 removed NOCONTEXT directives ...
Claus Gittinger <cg@exept.de>
parents: 1084
diff changeset
  4359
%{
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4360
    int ret;
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4361
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4362
    if (__isString(fullPathName)) {
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4363
#if !defined(MSDOS_LIKE) && !defined(__VMS__)
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4364
	__BEGIN_INTERRUPTABLE__
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4365
	do {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4366
	    ret = unlink((char *) __stringVal(fullPathName));
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4367
	} while (ret < 0 && errno == EINTR);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4368
	__END_INTERRUPTABLE__
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4369
	if (ret < 0) {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4370
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4371
	    RETURN ( false );
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4372
	}
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4373
	RETURN (true);
2619
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  4374
#else
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  4375
# if defined(HAS_REMOVE)
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  4376
	__BEGIN_INTERRUPTABLE__
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  4377
	do {
2959
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  4378
	    errno = 0;
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  4379
	    ret = remove((char *) __stringVal(fullPathName));
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  4380
	} while (ret < 0 && errno == EINTR);
2935
43a8f2077dbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2932
diff changeset
  4381
	__END_INTERRUPTABLE__
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  4382
	if (ret < 0) {
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  4383
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  4384
	    RETURN ( false );
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  4385
	}
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  4386
	RETURN (true);
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  4387
# else
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  4388
#  ifdef WIN32
2619
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  4389
	ret = DeleteFile((char *) __stringVal(fullPathName));
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  4390
	if (ret != TRUE) {
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4391
	    @global(LastErrorNumber) = __MKSMALLINT( WIN32_ERR(GetLastError()) );
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4392
	    RETURN (false);
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  4393
	}
2619
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  4394
	RETURN (true);
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  4395
#  endif
2619
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  4396
# endif
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  4397
#endif
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4398
    }
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4399
%}.
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4400
    ^ self primitiveFailed
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4401
!
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4402
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4403
renameFile:oldPath to:newPath
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4404
    "rename the file 'oldPath' to 'newPath'. 
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  4405
     Someone else has to care for the names to be correct and 
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  4406
     correct for the OS used - therefore, this should not be called
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  4407
     directlt. Instead, use Filename protocol to rename; this cares for
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  4408
     any invalid names.
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  4409
     Returns true if successful, false if not"
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4410
1104
219a06128193 removed NOCONTEXT directives ...
Claus Gittinger <cg@exept.de>
parents: 1084
diff changeset
  4411
%{
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4412
    int ret, eno;
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4413
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4414
    if (__isString(oldPath) && __isString(newPath)) {
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4415
#if defined(HAS_RENAME)
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4416
	__BEGIN_INTERRUPTABLE__
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4417
	do {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4418
	    ret = rename((char *) __stringVal(oldPath), (char *) __stringVal(newPath));
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4419
	} while (ret < 0 && errno == EINTR);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4420
	__END_INTERRUPTABLE__
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4421
#else
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  4422
# if !defined(MSDOS_LIKE) && !defined(__openVMS__)
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4423
	ret = link((char *) __stringVal(oldPath), (char *) __stringVal(newPath));
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4424
	if (ret >= 0) {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4425
	    ret = unlink((char *) __stringVal(oldPath));
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4426
	    if (ret < 0) {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4427
		eno = errno;
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4428
		unlink((char *) __stringVal(newPath));
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4429
		errno = eno;
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4430
	    }
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4431
	}
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4432
# endif
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4433
#endif
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4434
	if (ret < 0) {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4435
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4436
	    RETURN ( false );
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4437
	}
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4438
	RETURN (true);
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4439
    }
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4440
%}.
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4441
    ^ self primitiveFailed
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4442
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4443
    "
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4444
     OperatingSystem renameFile:'foo' to:'bar'
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4445
    "
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4446
!
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4447
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4448
truncateFile:aPathName to:newSize
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4449
    "change a files size return true on success, false on failure.
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4450
     This may not be supported on all architectures.
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4451
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4452
     This is a low-level entry - use Filename protocol."
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4453
1104
219a06128193 removed NOCONTEXT directives ...
Claus Gittinger <cg@exept.de>
parents: 1084
diff changeset
  4454
%{
1623
95009f9bfc18 use ftruncate if truncate is not available
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  4455
#ifdef HAS_TRUNCATE
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4456
    int ret;
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4457
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4458
    if (__isString(aPathName)
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4459
     && __isSmallInteger(newSize)) {
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4460
	__BEGIN_INTERRUPTABLE__
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4461
	do {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4462
	    ret = truncate((char *) __stringVal(aPathName), __intVal(newSize));
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4463
	} while (ret < 0 && errno == EINTR);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4464
	__END_INTERRUPTABLE__
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4465
	if (ret < 0) {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4466
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4467
	    RETURN ( false );
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4468
	}
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4469
	RETURN (true);
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4470
    }
1623
95009f9bfc18 use ftruncate if truncate is not available
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  4471
#else
95009f9bfc18 use ftruncate if truncate is not available
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  4472
# ifdef HAS_FTRUNCATE
95009f9bfc18 use ftruncate if truncate is not available
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  4473
    int ret;
95009f9bfc18 use ftruncate if truncate is not available
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  4474
    int fd;
95009f9bfc18 use ftruncate if truncate is not available
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  4475
95009f9bfc18 use ftruncate if truncate is not available
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  4476
    if (__isString(aPathName)
95009f9bfc18 use ftruncate if truncate is not available
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  4477
     && __isSmallInteger(newSize)) {
95009f9bfc18 use ftruncate if truncate is not available
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  4478
	do {
95009f9bfc18 use ftruncate if truncate is not available
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  4479
	    fd = open((char *) __stringVal(aPathName), 2);
95009f9bfc18 use ftruncate if truncate is not available
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  4480
	} while (fd < 0 && errno == EINTR);
95009f9bfc18 use ftruncate if truncate is not available
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  4481
	if (fd < 0) {
95009f9bfc18 use ftruncate if truncate is not available
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  4482
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
95009f9bfc18 use ftruncate if truncate is not available
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  4483
	    RETURN ( false );
95009f9bfc18 use ftruncate if truncate is not available
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  4484
	}
1632
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  4485
        
1623
95009f9bfc18 use ftruncate if truncate is not available
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  4486
	ret = ftruncate(fd, __intVal(newSize));
95009f9bfc18 use ftruncate if truncate is not available
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  4487
	close(fd);
95009f9bfc18 use ftruncate if truncate is not available
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  4488
	if (ret < 0) {
95009f9bfc18 use ftruncate if truncate is not available
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  4489
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
95009f9bfc18 use ftruncate if truncate is not available
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  4490
	    RETURN ( false );
95009f9bfc18 use ftruncate if truncate is not available
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  4491
	} 
95009f9bfc18 use ftruncate if truncate is not available
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  4492
	RETURN (true);
95009f9bfc18 use ftruncate if truncate is not available
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  4493
    }
95009f9bfc18 use ftruncate if truncate is not available
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  4494
# endif /* using FTRUNCATE */
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4495
#endif
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4496
%}.
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4497
    ^ self primitiveFailed
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4498
! !
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4499
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4500
!OperatingSystem class methodsFor:'ipc support - UNIX'!
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4501
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4502
makePipe
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4503
    "make a pipe, return array with two filedescriptors on success,
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4504
     nil on failure.
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4505
     This is a lowLevel entry, not for public use.
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4506
     See ExternalStream>>makePipe for a more user-friendly, public interface."
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4507
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4508
    |fd1 fd2|    
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4509
                
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4510
%{       
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4511
#ifdef UNIX_LIKE
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4512
     int fds[2];
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4513
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4514
     if (pipe(fds) < 0) {
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4515
	@global(LastErrorNumber) = __MKSMALLINT(errno);
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4516
	RETURN ( nil );
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4517
     }
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4518
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4519
     fd1 = __MKSMALLINT(fds[0]);
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4520
     fd2 = __MKSMALLINT(fds[1]);
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4521
#else
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4522
# ifdef WIN32
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4523
    HANDLE   pipeRead  = (HANDLE)0;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4524
    HANDLE   pipeWrite = (HANDLE)0;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4525
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4526
    SECURITY_ATTRIBUTES  process;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4527
 
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4528
    process.nLength = sizeof( process );
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4529
    process.lpSecurityDescriptor = NULL;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4530
    process.bInheritHandle = TRUE;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4531
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4532
    if( ! CreatePipe( &pipeRead, &pipeWrite, &process, 0 ) ) {
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4533
	@global(LastErrorNumber) = __MKSMALLINT( WIN32_ERR(GetLastError()) );
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4534
	RETURN ( nil );
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4535
    }
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4536
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4537
    fd1 = __MKOBJ(pipeRead);
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4538
    fd2 = __MKOBJ(pipeWrite);
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4539
# endif /* WIN32 */
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4540
#endif
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4541
%}.
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4542
    fd1 notNil ifTrue:[
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4543
	^ Array with:fd1 with:fd2.
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4544
    ].
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4545
    ^ nil
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4546
! !
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4547
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4548
!OperatingSystem class methodsFor:'ipc support - VMS'!
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4549
2976
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  4550
createCOMFileForVMSCommands:aCollectionOfCommandStrings
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  4551
    "since DCL seems to not support multiple commands in one
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  4552
     line, create a temporary COM file for them and let DCL
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  4553
     execute that one.
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  4554
     A kludge around a poor CLI design."
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  4555
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  4556
    |tmpComFile s|
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  4557
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  4558
    tmpComFile := Filename newTemporary withSuffix:'COM'.
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  4559
    s := tmpComFile writeStream.
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  4560
    aCollectionOfCommandStrings do:[:aCommand |
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4561
	(aCommand startsWith:$$) ifFalse:[
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4562
	    s nextPutAll:'$'.
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4563
	].
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4564
	s nextPutAll:aCommand.
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4565
	s nextPut:(Character nl).
2976
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  4566
    ].
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  4567
    s close.
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  4568
    ^ tmpComFile.
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  4569
!
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  4570
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  4571
createCOMFileForVMSCommand:aCommandString in:aDirectory
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  4572
    "since DCL seems to not support multiple commands in one
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  4573
     line, create a temporary COM file for a set def, followed
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  4574
     by the actual command string.
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  4575
     A kludge around a poor CLI design."
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  4576
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  4577
    |path|
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  4578
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  4579
    path := aDirectory asFilename pathName asFilename osNameForDirectory.
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  4580
    ^ self
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4581
	createCOMFileForVMSCommands:(Array
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4582
					with:('set def ' , path)
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4583
					with:aCommandString).
2976
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  4584
!
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  4585
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4586
createMailBox
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4587
    "create a VMS mailBox. Return the mbx-channel number or nil on failure.
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4588
     This is only supported with VMS and needed with I/O redirection when
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4589
     OS commands are spawned. On non-VMS systems, nil is always returned."
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4590
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4591
    |mbxChannel|
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4592
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4593
%{
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4594
#ifdef __VMS__
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4595
    struct IOSB iosb;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4596
    static int mbxSize = 0;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4597
    int status;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4598
    short channel;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4599
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4600
    /*
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4601
     * get the mailbox size, when called for the very first time.
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4602
     */
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4603
    if (mbxSize == 0) {
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4604
	struct itm$list3 syilist[2] = {
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4605
	  { sizeof(mbxSize), SYI$_MAXBUF, &mbxSize, (void *) 0 },
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4606
	  { 0, 0, 0, 0}
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4607
	};
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4608
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4609
	/*
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4610
	 * Use the smaller of SYI$_MAXBUF and 2048 for the mailbox size
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4611
	 */
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4612
	status = SYS$GETSYIW(0, 0, 0, syilist, &iosb, 0, 0, 0);
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4613
	if (status != SS$_NORMAL && !(iosb.status & STS$M_SUCCESS)) {
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4614
	    vaxc$errno = iosb.status;
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4615
	    errno = EVMSERR;
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4616
	    fprintf(stderr, "OperatingSystem [warning]: $GETSYIW failure for SYI$_MAXBUF");
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4617
	    RETURN( nil );
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4618
	}
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4619
	if (mbxSize > 2048) {
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4620
	    mbxSize = 2048;
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4621
	}
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4622
    }
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4623
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4624
    /*
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4625
     * create a mailBox ...
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4626
     */
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4627
    status = SYS$CREMBX (0, &channel, mbxSize, mbxSize, 0, 0, 0, 0);
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4628
    if (status != SS$_NORMAL) {
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4629
	vaxc$errno = status;
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4630
	errno = EVMSERR;
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4631
	fprintf(stderr, "OperatingSystem [warning]: $CREMBX failure");
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4632
	RETURN ( nil );
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4633
    }
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4634
    mbxChannel = __MKSMALLINT(channel);
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4635
#endif
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4636
%}.
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4637
    ^ mbxChannel
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4638
!
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4639
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4640
createMailBoxPair
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4641
    |in out|
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4642
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4643
    in := self createMailBox.
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4644
    in isNil ifTrue:[
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4645
	^ nil
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4646
    ].
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4647
    out := self createMailBox.
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4648
    out isNil ifTrue:[
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4649
	self destroyMailBox:in. 
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4650
	^ nil
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4651
    ].
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4652
    ^ Array with:in with:out
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4653
!
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4654
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4655
destroyMailBox:aChannelNr
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4656
    "deallocate a mailBox.
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4657
     This is only needed for VMS subprocess handling and ignored
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4658
     on other systems."
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4659
%{
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4660
#ifdef __VMS__
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4661
    if (__isSmallInteger(aChannelNr)) {
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4662
	int channel = __intVal(aChannelNr);
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4663
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4664
	SYS$DASSGN (channel);
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4665
    }
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4666
#endif
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4667
%}.
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4668
!
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4669
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4670
mailBoxNameOf:aChannelNr
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4671
    "retrieve a mailBoxes name, given its channel nr.
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4672
     This is required in VMS for subprocess execution, to be
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4673
     able to open a mailbox as a file.
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4674
     Non VMS systems return nil."
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4675
%{
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4676
#ifdef __VMS__
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4677
    struct IOSB iosb;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4678
    int status;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4679
    short channel;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4680
    struct Vstring mbxname = { sizeof(mbxname.body) };
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4681
    struct itm$list3 mbxlist[2] = {
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4682
      { sizeof(mbxname.body)-1, DVI$_DEVNAM, &mbxname.body, &mbxname.length },
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4683
      { 0, 0, 0, 0}
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4684
    };
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4685
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4686
    if (__isSmallInteger(aChannelNr)) {
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4687
	channel = __intVal(aChannelNr);
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4688
	status = SYS$GETDVIW (0, channel, 0, &mbxlist, &iosb, 0, 0, 0);
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4689
	if (status != SS$_NORMAL && !(iosb.status & STS$M_SUCCESS)) {
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4690
	    vaxc$errno = iosb.status;
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4691
	    errno = EVMSERR;
2973
c0c37395988a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  4692
#if 0
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4693
	    fprintf(stderr, "OperatingSystem [info]: $GETDVIW for mailBox name failed mbx=%d\n",channel);
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4694
#endif
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4695
	    RETURN ( nil );
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  4696
	}
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4697
	mbxname.body[mbxname.length] = 0;
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4698
	RETURN (__MKSTRING(mbxname.body));
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4699
    }
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4700
#endif
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4701
%}.
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4702
    ^ nil
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4703
! !
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  4704
1799
0a2c5890f4f3 handle 'foo///' in directoryName
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  4705
!OperatingSystem class methodsFor:'file access rights'!
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4706
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4707
accessMaskFor:aSymbol
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4708
    "return the access bits mask for numbers as returned by 
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4709
     OperatingSystem>>accessModeOf:
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4710
     and expected by OperatingSystem>>changeAccessModeOf:to:.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4711
     Since these numbers are OS dependent, always use the mask
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4712
     (never hardcode 8rxxx into your code)."
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  4713
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  4714
%{  /* NOCONTEXT */
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4715
#   ifndef S_IRUSR
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4716
    /* posix systems should define these ... */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4717
#    define S_IRUSR 0400
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4718
#    define S_IWUSR 0200
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4719
#    define S_IXUSR 0100
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4720
#    define S_IRGRP 0040
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4721
#    define S_IWGRP 0020
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4722
#    define S_IXGRP 0010
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4723
#    define S_IROTH 0004
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4724
#    define S_IWOTH 0002
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4725
#    define S_IXOTH 0001
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4726
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4727
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4728
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4729
    if (aSymbol == @symbol(readUser)) {
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  4730
	RETURN ( __MKSMALLINT(S_IRUSR) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4731
    }
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4732
    if (aSymbol == @symbol(writeUser)) {
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  4733
	RETURN ( __MKSMALLINT(S_IWUSR) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4734
    }
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4735
    if (aSymbol == @symbol(executeUser)) {
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  4736
	RETURN ( __MKSMALLINT(S_IXUSR) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4737
    }
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4738
    if (aSymbol == @symbol(readGroup)) {
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  4739
	RETURN ( __MKSMALLINT(S_IRGRP) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4740
    }
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4741
    if (aSymbol == @symbol(writeGroup)) {
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  4742
	RETURN ( __MKSMALLINT(S_IWGRP) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4743
    }
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4744
    if (aSymbol == @symbol(executeGroup)) {
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  4745
	RETURN ( __MKSMALLINT(S_IXGRP) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4746
    }
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4747
    if (aSymbol == @symbol(readOthers)) {
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  4748
	RETURN ( __MKSMALLINT(S_IROTH) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4749
    }
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4750
    if (aSymbol == @symbol(writeOthers)) {
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  4751
	RETURN ( __MKSMALLINT(S_IWOTH) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4752
    }
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4753
    if (aSymbol == @symbol(executeOthers)) {
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  4754
	RETURN ( __MKSMALLINT(S_IXOTH) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4755
    }
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4756
%}.
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  4757
    ^ self primitiveFailed
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4758
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4759
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4760
     OperatingSystem accessMaskFor:#readUser
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4761
    "
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  4762
!
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  4763
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4764
accessModeOf:aPathName
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4765
    "return a number representing access rights rwxrwxrwx for owner,
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4766
     group and others. Return nil if such a file does not exist.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4767
     Notice that the returned number is OS dependent - use the 
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4768
     modeMasks as returned by OperatingSystem>>accessMaskFor:"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4769
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4770
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4771
     this could have been implemented as:
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4772
	(self infoOf:aPathName) at:#mode
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4773
     but for huge directory searches the code below is faster
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4774
    "
345
claus
parents: 329
diff changeset
  4775
1104
219a06128193 removed NOCONTEXT directives ...
Claus Gittinger <cg@exept.de>
parents: 1084
diff changeset
  4776
%{
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4777
    struct stat buf;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4778
    int ret;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4779
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4780
    if (__isString(aPathName)) {
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  4781
# ifdef TRACE_STAT_CALLS
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  4782
	printf("stat on '%s' for accessMode\n", __stringVal(aPathName));
2912
d196f7a67d74 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2904
diff changeset
  4783
# endif
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4784
	__BEGIN_INTERRUPTABLE__
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4785
	do {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4786
	    ret = stat((char *) __stringVal(aPathName), &buf);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4787
	} while ((ret < 0) && (errno == EINTR));
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4788
	__END_INTERRUPTABLE__
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4789
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4790
	if (ret < 0) {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4791
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4792
	    RETURN ( nil );
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4793
	}
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4794
	RETURN ( __MKSMALLINT(buf.st_mode & 0777) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4795
    }
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4796
%}.
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  4797
   ^ self primitiveFailed
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4798
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4799
   "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4800
    (OperatingSystem accessModeOf:'/') printStringRadix:8
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  4801
   "
345
claus
parents: 329
diff changeset
  4802
!
claus
parents: 329
diff changeset
  4803
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4804
changeAccessModeOf:aPathName to:modeBits
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4805
    "change the access rights of aPathName to the OS dependent modeBits.
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4806
     You should construct this mask using accessMaskFor, to be OS
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4807
     independent. Return true if changed, 
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4808
     false if such a file does not exist or change was not allowd."
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4809
1104
219a06128193 removed NOCONTEXT directives ...
Claus Gittinger <cg@exept.de>
parents: 1084
diff changeset
  4810
%{
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4811
    int ret;
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4812
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4813
    if (__isString(aPathName) && __isSmallInteger(modeBits)) {
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4814
	__BEGIN_INTERRUPTABLE__
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4815
	do {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4816
	    ret = chmod((char *)__stringVal(aPathName), __intVal(modeBits));
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4817
	} while (ret < 0 && errno == EINTR);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4818
	__END_INTERRUPTABLE__
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4819
	if (ret < 0) {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4820
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4821
	    RETURN ( false );
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4822
	}
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  4823
	RETURN ( true );
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4824
    }
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4825
%}.
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4826
    ^ self primitiveFailed
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4827
! !
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  4828
1799
0a2c5890f4f3 handle 'foo///' in directoryName
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  4829
!OperatingSystem class methodsFor:'file locking'!
1615
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  4830
1617
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4831
lockFD:aFileDescriptor shared:isSharedReadLock blocking:blockIfLocked
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4832
   "set a lock on the file represented by aFileDescriptor.
1615
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  4833
    (such as returned by ExternalStream>>fileDescriptor).
1617
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4834
    On some systems, only advisory locks are available -
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4835
    these depends on other accessors to also perform the locking operation.
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4836
    If they do not, they may still access the file 
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4837
    (on some systems, locks are mandatory, on others, they are advisory). 
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4838
    The isSharedReadLock argument (if true) specifies if multiple readers
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4839
    are to be allowed - if false, they are not.
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4840
    On some systems, all locks are non-exclusive locks.
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4841
1615
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  4842
    Returns true, if the lock was aquired, false otherwise.
1617
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4843
1616
fa734ea238f8 type & include file.h on all systems
Claus Gittinger <cg@exept.de>
parents: 1615
diff changeset
  4844
    Notice, that not all OS's support these locks; 
fa734ea238f8 type & include file.h on all systems
Claus Gittinger <cg@exept.de>
parents: 1615
diff changeset
  4845
    on some, this may simply be a no-op.
1615
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  4846
    Also notice, that some systems block the process, to wait for the lock.
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  4847
    This can (again: on some systems) be avoided by passing a false blockIfLocked
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  4848
    argument."
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  4849
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  4850
%{
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  4851
    if (__isSmallInteger(aFileDescriptor)) {
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  4852
	int fd = __intVal(aFileDescriptor);
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  4853
	int lockArg;
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  4854
1617
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4855
	/*
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4856
	 * claus: sigh - each one has a different interface ... 
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4857
	 */
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4858
#if defined(F_SETLK)
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4859
	{
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4860
	    /* 
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4861
	     * new fcntl(SETLK) interface;
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4862
	     * available on SYSV4 and Linux
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4863
	     */
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4864
	    struct flock flock;
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4865
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4866
	    if (isSharedReadLock == true) {
1632
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  4867
		flock.l_type = F_RDLCK;
1617
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4868
	    } else {
1632
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  4869
		flock.l_type = F_WRLCK;
1617
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4870
	    }
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4871
	    flock.l_whence = 0;
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4872
	    flock.l_start = 0;
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4873
	    flock.l_len = 0;
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4874
	    lockArg = F_SETLK;
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4875
# if defined(F_SETLKW)
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4876
	    if (blockIfLocked == true) {
1632
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  4877
		lockArg = F_SETLKW;
1617
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4878
	    }
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4879
# endif
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4880
	    if (fcntl(fd, lockArg, &flock) != -1) {
1632
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  4881
		RETURN (true);
1617
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4882
	    }
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4883
	}
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4884
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4885
#else /* no F_SETLK available */
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4886
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4887
# if defined(LOCK_EX) && defined(LOCK_UN)
1632
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  4888
	/* 
1617
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4889
	 * BSD 4.3 advisory locks
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4890
	 */
1615
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  4891
	lockArg = LOCK_EX;
1617
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4892
#  if defined(LOCK_SH)
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4893
	if (isSharedReadLock == true) {
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4894
	    lockArg = LOCK_SH
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4895
	}
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4896
#  endif
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4897
#  if defined(LOCK_NB)
1615
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  4898
	if (blockIfLocked == false) {
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  4899
	    lockArg |= LOCK_NB;
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  4900
	}
1617
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4901
#  endif
1632
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  4902
	if (flock(fd, lockArg) != -1) {
1615
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  4903
	    RETURN (true);
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  4904
	}
1617
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4905
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4906
# else /* no flock available */
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4907
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4908
#  if defined(F_LOCK) && defined(F_UNLOCK)
1632
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  4909
	/* 
1617
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4910
	 * SYSV3 advisory locks
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4911
	 */
1615
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  4912
	if (lockf(fd, F_LOCK, 0) != -1) {
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  4913
	    RETURN (true);
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  4914
	}
1617
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4915
#  endif
1615
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  4916
# endif
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  4917
#endif
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  4918
    }
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  4919
%}.
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  4920
    ^ false
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  4921
!
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  4922
2627
8453b8435b33 added queries about symbolic and hard links being supported
Claus Gittinger <cg@exept.de>
parents: 2624
diff changeset
  4923
supportsFileLinks
8453b8435b33 added queries about symbolic and hard links being supported
Claus Gittinger <cg@exept.de>
parents: 2624
diff changeset
  4924
    "return true, if the OS supports file links (hard links).
8453b8435b33 added queries about symbolic and hard links being supported
Claus Gittinger <cg@exept.de>
parents: 2624
diff changeset
  4925
     Typically, only unix returns true here."
8453b8435b33 added queries about symbolic and hard links being supported
Claus Gittinger <cg@exept.de>
parents: 2624
diff changeset
  4926
8453b8435b33 added queries about symbolic and hard links being supported
Claus Gittinger <cg@exept.de>
parents: 2624
diff changeset
  4927
%{ /* NOCONTEXT */
8453b8435b33 added queries about symbolic and hard links being supported
Claus Gittinger <cg@exept.de>
parents: 2624
diff changeset
  4928
#ifdef UNIX_LIKE
8453b8435b33 added queries about symbolic and hard links being supported
Claus Gittinger <cg@exept.de>
parents: 2624
diff changeset
  4929
    RETURN (true);
8453b8435b33 added queries about symbolic and hard links being supported
Claus Gittinger <cg@exept.de>
parents: 2624
diff changeset
  4930
#endif
2628
Claus Gittinger <cg@exept.de>
parents: 2627
diff changeset
  4931
%}.
2627
8453b8435b33 added queries about symbolic and hard links being supported
Claus Gittinger <cg@exept.de>
parents: 2624
diff changeset
  4932
    ^ false
8453b8435b33 added queries about symbolic and hard links being supported
Claus Gittinger <cg@exept.de>
parents: 2624
diff changeset
  4933
!
8453b8435b33 added queries about symbolic and hard links being supported
Claus Gittinger <cg@exept.de>
parents: 2624
diff changeset
  4934
1616
fa734ea238f8 type & include file.h on all systems
Claus Gittinger <cg@exept.de>
parents: 1615
diff changeset
  4935
supportsFileLocks
1617
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4936
    "return true, if the OS supports file locking"
1615
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  4937
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  4938
%{ /* NOCONTEXT */
1617
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4939
#if defined(F_SETLK)
1615
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  4940
    RETURN (true);
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  4941
#else
1617
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4942
# if defined(LOCK_EX) && defined(LOCK_UN)
1615
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  4943
    RETURN (true);
1617
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4944
# else
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4945
#  if defined(F_LOCK) && defined(F_UNLOCK)
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4946
    RETURN (true);
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4947
#  endif
1615
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  4948
# endif
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  4949
#endif
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  4950
%}.
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  4951
    ^ false
1616
fa734ea238f8 type & include file.h on all systems
Claus Gittinger <cg@exept.de>
parents: 1615
diff changeset
  4952
fa734ea238f8 type & include file.h on all systems
Claus Gittinger <cg@exept.de>
parents: 1615
diff changeset
  4953
    "
fa734ea238f8 type & include file.h on all systems
Claus Gittinger <cg@exept.de>
parents: 1615
diff changeset
  4954
     OperatingSystem supportsFileLocks
fa734ea238f8 type & include file.h on all systems
Claus Gittinger <cg@exept.de>
parents: 1615
diff changeset
  4955
    "
1617
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4956
!
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4957
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4958
supportsNonBlockingFileLocks
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4959
    "return true, if the OS supports nonBlocking file locking
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4960
     (i.e. with immediate return instead of waiting for the lock)"
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4961
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4962
%{ /* NOCONTEXT */
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4963
#if defined(F_SETLK) && defined(F_SETLKW)
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4964
    RETURN (true);
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4965
#else
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4966
# if defined(LOCK_EX) && defined(LOCK_UN) && defined(LOCK_NB)
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4967
    RETURN (true);
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4968
# endif
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4969
#endif
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4970
%}.
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4971
    ^ false
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4972
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4973
    "
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4974
     OperatingSystem supportsNonBlockingFileLocks
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4975
    "
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4976
!
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4977
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4978
supportsSharedLocks
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4979
    "return true, if the OS supports shared (i.e. multiple reader)
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4980
     file locking."
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4981
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4982
%{ /* NOCONTEXT */
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4983
#if defined(F_SETLK) && defined(F_RDLCK) && defined(F_WRLCK)
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4984
    RETURN (true);
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4985
#else
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4986
# if defined(LOCK_EX) && defined(LOCK_SH) && defined(LOCK_UN)
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4987
    RETURN (true);
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4988
# endif
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4989
#endif
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4990
%}.
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4991
    ^ false
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4992
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4993
    "
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4994
     OperatingSystem supportsNonBlockingFileLocks
9b72f5efb8cb added fcntl based file locking
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  4995
    "
1621
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  4996
!
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  4997
2627
8453b8435b33 added queries about symbolic and hard links being supported
Claus Gittinger <cg@exept.de>
parents: 2624
diff changeset
  4998
supportsSymbolicLinks
8453b8435b33 added queries about symbolic and hard links being supported
Claus Gittinger <cg@exept.de>
parents: 2624
diff changeset
  4999
    "return true, if the OS supports symbolic links on files/directories.
8453b8435b33 added queries about symbolic and hard links being supported
Claus Gittinger <cg@exept.de>
parents: 2624
diff changeset
  5000
     Typically, only Unix returns true here"
8453b8435b33 added queries about symbolic and hard links being supported
Claus Gittinger <cg@exept.de>
parents: 2624
diff changeset
  5001
8453b8435b33 added queries about symbolic and hard links being supported
Claus Gittinger <cg@exept.de>
parents: 2624
diff changeset
  5002
%{ /* NOCONTEXT */
8453b8435b33 added queries about symbolic and hard links being supported
Claus Gittinger <cg@exept.de>
parents: 2624
diff changeset
  5003
#ifdef UNIX_LIKE
8453b8435b33 added queries about symbolic and hard links being supported
Claus Gittinger <cg@exept.de>
parents: 2624
diff changeset
  5004
    RETURN (true);
8453b8435b33 added queries about symbolic and hard links being supported
Claus Gittinger <cg@exept.de>
parents: 2624
diff changeset
  5005
#endif
2628
Claus Gittinger <cg@exept.de>
parents: 2627
diff changeset
  5006
%}.
2627
8453b8435b33 added queries about symbolic and hard links being supported
Claus Gittinger <cg@exept.de>
parents: 2624
diff changeset
  5007
    ^ false
8453b8435b33 added queries about symbolic and hard links being supported
Claus Gittinger <cg@exept.de>
parents: 2624
diff changeset
  5008
!
8453b8435b33 added queries about symbolic and hard links being supported
Claus Gittinger <cg@exept.de>
parents: 2624
diff changeset
  5009
1621
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5010
unlockFD:aFileDescriptor
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5011
    "clear a file lock on the file represented by aFileDescriptor,
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5012
     which was previously aquired by #lockFD:.
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5013
     Return false, if the unlock failed 
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5014
     (which may happens when a wrong fd is passed, 
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5015
      no lock was set previously, or the systsem does not support locks).
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5016
     Notice, that not all OS's support file locks; 
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5017
     on some, this may simply be a no-op."
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5018
     
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5019
%{
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5020
    if (__isSmallInteger(aFileDescriptor)) {
1632
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  5021
	int fd = __intVal(aFileDescriptor);
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  5022
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  5023
	/*
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  5024
	 * claus: sigh - each one has a different interface ...
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  5025
	 */
1621
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5026
#if defined(F_SETLK)
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5027
	{
1632
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  5028
	    /*
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  5029
	     * new fcntl(SETLK) interface;
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  5030
	     * available on SYSV4 and Linux
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  5031
	     */
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  5032
	    struct flock flock;
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  5033
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  5034
	    flock.l_type = F_UNLCK;
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  5035
	    flock.l_whence = 0;
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  5036
	    flock.l_start = 0;
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  5037
	    flock.l_len = 0;
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  5038
	    if (fcntl(fd, F_SETLK, &flock) != -1) {
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  5039
		RETURN (true);
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  5040
	    }
1621
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5041
	}
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5042
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5043
#else /* no F_SETLK available */
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5044
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5045
# if defined(LOCK_EX) && defined(LOCK_UN)
1632
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  5046
	/*
1621
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5047
	 * BSD 4.3 advisory locks
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5048
	 */
1632
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  5049
	if (flock(fd, LOCK_UN) != -1) {
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  5050
	    RETURN (true);
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  5051
	}
1621
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5052
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5053
# else /* no flock available */
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5054
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5055
#  if defined(F_LOCK) && defined(F_UNLOCK)
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5056
	/* 
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5057
	 * SYSV3 advisory locks
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5058
	 */
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5059
	if (lockf(fd, F_UNLOCK, 0) != -1) {
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5060
	    RETURN (true);
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5061
	}
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5062
#  endif
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5063
# endif
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5064
#endif
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5065
    }
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5066
%}.
30620c379b35 file-lock example
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  5067
    ^ false
1615
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  5068
! !
0dc932c45c67 added support for advisory file locks (on systems that support them)
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  5069
1799
0a2c5890f4f3 handle 'foo///' in directoryName
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  5070
!OperatingSystem class methodsFor:'file queries'!
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  5071
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5072
baseNameOf:aPath
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5073
    self obsoleteMethodWarning:'use asFilename baseName'.
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5074
    ^ aPath asFilename baseName
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5075
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5076
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5077
caseSensitiveFilenames
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5078
    "return true, if the OS has caseSensitive file naming.
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5079
     On MSDOS, this will return false; 
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5080
     on a real OS, we return true."
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5081
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5082
%{  /* NOCONTEXT */
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5083
#if defined(__VMS__)
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5084
    RETURN (false);
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5085
#endif
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5086
#if defined(MSDOS_LIKE)
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5087
    RETURN (false);
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5088
#endif
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5089
%}.
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5090
    ^ true
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5091
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5092
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5093
compressPath:pathName
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5094
    "return the pathName compressed - that is, remove all ..-entries
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5095
     and . entries. This does not always (in case of symbolic links)
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5096
     return the true pathName and is therefore used as a fallback
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5097
     if realPath and popen failed."
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5098
1858
cbbc11c01e10 return a private object for fileInfo.
Claus Gittinger <cg@exept.de>
parents: 1845
diff changeset
  5099
    |names n "{ Class: SmallInteger }" |
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5100
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5101
    names := pathName 
1885
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5102
		asCollectionOfSubstringsSeparatedBy:self fileSeparator.
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5103
    names := names asOrderedCollection.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5104
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5105
     cut off initial double-slashes
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5106
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5107
    [names startsWith:#('' '')] whileTrue:[
1885
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5108
	names removeFirst.
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5109
    ].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5110
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5111
     cut off double-slashes at end
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5112
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5113
    [names endsWith:#('')] whileTrue:[
1885
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5114
	names removeLast.
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5115
    ].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5116
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5117
     cut off current-dir at beginning
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5118
    "
1858
cbbc11c01e10 return a private object for fileInfo.
Claus Gittinger <cg@exept.de>
parents: 1845
diff changeset
  5119
    n := names size.
cbbc11c01e10 return a private object for fileInfo.
Claus Gittinger <cg@exept.de>
parents: 1845
diff changeset
  5120
    [(n >= 2) and:[names startsWith:#('.')]] whileTrue:[
1885
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5121
	names removeFirst.
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5122
	n := n - 1.
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5123
    ].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5124
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5125
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5126
     cut off parent-dirs at end
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5127
    "
1858
cbbc11c01e10 return a private object for fileInfo.
Claus Gittinger <cg@exept.de>
parents: 1845
diff changeset
  5128
    [(n > 2) 
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5129
     and:[(names endsWith:#('..'))
1858
cbbc11c01e10 return a private object for fileInfo.
Claus Gittinger <cg@exept.de>
parents: 1845
diff changeset
  5130
     and:[((names at:(n - 1)) startsWith:'.') not ]]] whileTrue:[
1885
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5131
	names removeLast; removeLast.
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5132
	n := n - 2.
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5133
    ].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5134
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5135
    ^ names asStringWith:self fileSeparator 
1885
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5136
		    from:1
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5137
		    to:n
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5138
		    compressTabs:false final:nil 
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5139
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5140
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5141
     OperatingSystem compressPath:'./..'    
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5142
     OperatingSystem compressPath:'/foo/bar/baz/..'  
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5143
     OperatingSystem compressPath:'foo/bar/baz/..'  
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5144
     OperatingSystem compressPath:'foo/bar/baz/../'  
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5145
     OperatingSystem compressPath:'foo/bar/baz/..///' 
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5146
     OperatingSystem compressPath:'///foo/bar/baz/..///' 
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5147
    "
1858
cbbc11c01e10 return a private object for fileInfo.
Claus Gittinger <cg@exept.de>
parents: 1845
diff changeset
  5148
cbbc11c01e10 return a private object for fileInfo.
Claus Gittinger <cg@exept.de>
parents: 1845
diff changeset
  5149
    "Modified: 1.11.1996 / 20:13:48 / cg"
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  5150
!
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  5151
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5152
directoryNameOf:aPath
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5153
    self obsoleteMethodWarning:'use asFilename directoryName'.
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5154
    ^ aPath asFilename directoryName
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5155
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5156
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5157
fileSeparator
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5158
    "return the character used to separate names in a path.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5159
     This character differs for MSDOS and other systems,
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5160
     (but those are currently not supported - so this is some
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5161
      preparation for the future)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5162
2600
6f9c66f71706 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2599
diff changeset
  5163
    self isMSDOSlike ifTrue:[
2602
074f99294753 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2600
diff changeset
  5164
	^ $\
2600
6f9c66f71706 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2599
diff changeset
  5165
    ].
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5166
    ^ $/
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5167
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5168
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5169
getDriveList
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5170
    "return a list of volumes in the system. 
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5171
     On unix, no such thing like a volume exists 
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5172
     - there, a syntetic list with root, home & current is returned. 
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5173
     On MSDOS, a list of drive letters is (eventually) returned.
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5174
     On VMS, a list of volumes is (eventually) returned."
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5175
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5176
    |list|
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5177
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5178
    list := OrderedCollection new.
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5179
%{
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5180
#ifdef MSDOS_LIKE
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5181
    /*
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5182
     * add drive letters as strings to list ...
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5183
     */
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5184
    RETURN (list);
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5185
#endif
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5186
#if defined(__VMS__)
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5187
    /*
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5188
     * add volume names to list ...
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5189
     */
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5190
    RETURN (list);
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5191
#endif
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5192
%}.
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5193
    "/
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5194
    "/ default: retrurn array filled with
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5195
    "/ root, home and current directories.
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5196
    "/
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5197
    ^ Array 
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5198
	with:'/'
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5199
	with:(self getHomeDirectory)
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5200
	with:(Filename currentDirectory pathName)
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5201
!
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5202
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5203
idOf:aPathName
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  5204
    "return the fileNumber (i.e. inode number) of a file.
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  5205
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  5206
     Not all operatingSystems may provide this - on those that do not,
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  5207
     some dummy id will be returned.
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  5208
     On unix, this information can be used to check for two files being 
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  5209
     physically identical, even if found in different directories 
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  5210
     (i.e. if they are hardLinked)."
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5211
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5212
    |i|
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5213
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5214
     this could have been implemented as:
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5215
	(self infoOf:aPathName) id 
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5216
     but for huge directory searches the code below is faster
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5217
    "
1104
219a06128193 removed NOCONTEXT directives ...
Claus Gittinger <cg@exept.de>
parents: 1084
diff changeset
  5218
%{
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5219
    struct stat buf;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5220
    int ret;
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5221
    unsigned INT ino;
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5222
    OBJ retVal;
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5223
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5224
    if (__isString(aPathName)) {
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5225
# ifdef TRACE_STAT_CALLS
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5226
	printf("stat on '%s' for id\n", __stringVal(aPathName));
2912
d196f7a67d74 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2904
diff changeset
  5227
# endif
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5228
	__BEGIN_INTERRUPTABLE__
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5229
	do {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5230
	    ret = stat((char *) __stringVal(aPathName), &buf);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5231
	} while (ret < 0 && errno == EINTR);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5232
	__END_INTERRUPTABLE__
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5233
	if (ret >= 0) {
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5234
#ifdef __openVMS__
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5235
# ifdef alpha64
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5236
	    ino = buf.st_ino[2];
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5237
	    ino = (ino << 16) + buf.st_ino[1];
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5238
	    ino = (ino << 16) + buf.st_ino[0];
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5239
	    retVal = __MKUINT(ino);
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5240
# else
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5241
	    {
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5242
		unsigned inoLow, inoHi;
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5243
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5244
		inoHi = buf.st_ino[2];
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5245
		inoLow = buf.st_ino[1];
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5246
		inoLow = (inoLow << 16) + buf.st_ino[0];
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5247
		retVal = __MKLARGEINT64(1, inoLow, inoHi);
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5248
	    }
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5249
# endif
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5250
#else
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5251
	    ino = buf.st_ino;
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5252
	    retVal = __MKUINT(ino);
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5253
#endif
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5254
	    RETURN (retVal);
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5255
	}
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5256
	@global(LastErrorNumber) = __MKSMALLINT(errno);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5257
	RETURN (nil);
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5258
    }
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5259
%}.
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5260
    i := self infoOf:aPathName.
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5261
    i notNil ifTrue:[^ i id].
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5262
    ^ nil.
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5263
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5264
    "OperatingSystem idOf:'/'"
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  5265
!
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  5266
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5267
infoOf:aPathName
1858
cbbc11c01e10 return a private object for fileInfo.
Claus Gittinger <cg@exept.de>
parents: 1845
diff changeset
  5268
    "return some object filled with info for the file 'aPathName';
cbbc11c01e10 return a private object for fileInfo.
Claus Gittinger <cg@exept.de>
parents: 1845
diff changeset
  5269
     the info (for which corresponding access methods are understood by
cbbc11c01e10 return a private object for fileInfo.
Claus Gittinger <cg@exept.de>
parents: 1845
diff changeset
  5270
     the returned object) is:
2617
06d1b7337a33 added the alternativeName to the fileInfo (MSDOS name under NT)
Claus Gittinger <cg@exept.de>
parents: 2616
diff changeset
  5271
	 type            - a symbol giving the files type
06d1b7337a33 added the alternativeName to the fileInfo (MSDOS name under NT)
Claus Gittinger <cg@exept.de>
parents: 2616
diff changeset
  5272
	 mode            - numeric access mode 
06d1b7337a33 added the alternativeName to the fileInfo (MSDOS name under NT)
Claus Gittinger <cg@exept.de>
parents: 2616
diff changeset
  5273
	 uid             - owners user id
06d1b7337a33 added the alternativeName to the fileInfo (MSDOS name under NT)
Claus Gittinger <cg@exept.de>
parents: 2616
diff changeset
  5274
	 gid             - owners group id
06d1b7337a33 added the alternativeName to the fileInfo (MSDOS name under NT)
Claus Gittinger <cg@exept.de>
parents: 2616
diff changeset
  5275
	 size            - files size
06d1b7337a33 added the alternativeName to the fileInfo (MSDOS name under NT)
Claus Gittinger <cg@exept.de>
parents: 2616
diff changeset
  5276
	 id              - files number (i.e. inode number)
06d1b7337a33 added the alternativeName to the fileInfo (MSDOS name under NT)
Claus Gittinger <cg@exept.de>
parents: 2616
diff changeset
  5277
	 accessed        - last access time (as Timestamp)
06d1b7337a33 added the alternativeName to the fileInfo (MSDOS name under NT)
Claus Gittinger <cg@exept.de>
parents: 2616
diff changeset
  5278
	 modified        - last modification time (as Timestamp)
06d1b7337a33 added the alternativeName to the fileInfo (MSDOS name under NT)
Claus Gittinger <cg@exept.de>
parents: 2616
diff changeset
  5279
	 statusChanged   - last status change time (as Timestamp)
06d1b7337a33 added the alternativeName to the fileInfo (MSDOS name under NT)
Claus Gittinger <cg@exept.de>
parents: 2616
diff changeset
  5280
	 alternativeName - (windows only: the MSDOS name of the file)
1858
cbbc11c01e10 return a private object for fileInfo.
Claus Gittinger <cg@exept.de>
parents: 1845
diff changeset
  5281
cbbc11c01e10 return a private object for fileInfo.
Claus Gittinger <cg@exept.de>
parents: 1845
diff changeset
  5282
     Some of the fields may be returned as nil on systems which do not provide
cbbc11c01e10 return a private object for fileInfo.
Claus Gittinger <cg@exept.de>
parents: 1845
diff changeset
  5283
     all of the information.
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  5284
     Return nil if such a file does not exist. 
2617
06d1b7337a33 added the alternativeName to the fileInfo (MSDOS name under NT)
Claus Gittinger <cg@exept.de>
parents: 2616
diff changeset
  5285
     For symbolic links (if supported by the OS), 
06d1b7337a33 added the alternativeName to the fileInfo (MSDOS name under NT)
Claus Gittinger <cg@exept.de>
parents: 2616
diff changeset
  5286
     the info of the pointed-to-file (i.e. the target) is returned;
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  5287
     use #linkInfoOf: to get info about the link itself.
1858
cbbc11c01e10 return a private object for fileInfo.
Claus Gittinger <cg@exept.de>
parents: 1845
diff changeset
  5288
    "
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5289
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5290
    |info type mode uid gid size id 
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5291
     atime mtime ctime 
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5292
     aOStime mOStime cOStime
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5293
     aYr aMon aDay aHr aMin aSec aMS
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5294
     mYr mMon mDay mHr mMin mSec mMS
2617
06d1b7337a33 added the alternativeName to the fileInfo (MSDOS name under NT)
Claus Gittinger <cg@exept.de>
parents: 2616
diff changeset
  5295
     cYr cMon cDay cHr cMin cSec cMS
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5296
     name2 
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5297
     recordFormat recordAttribs fixedHeaderSize recordSize
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5298
     recordFormatNumeric|
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5299
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5300
%{
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5301
    struct stat buf;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5302
    int ret;
2617
06d1b7337a33 added the alternativeName to the fileInfo (MSDOS name under NT)
Claus Gittinger <cg@exept.de>
parents: 2616
diff changeset
  5303
    char nameBuffer[15];
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5304
    unsigned INT ino;
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5305
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5306
    if (__isString(aPathName)) {
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5307
#ifdef WIN32
2620
6fbb5b11586b mkdir no longer uses systemCommand
Claus Gittinger <cg@exept.de>
parents: 2619
diff changeset
  5308
	HANDLE hFile;
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5309
	SYSTEMTIME creationTime;
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5310
	SYSTEMTIME accessTime;
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5311
	SYSTEMTIME modificationTime;
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5312
	int modeBits = 0;
2609
68abf045b637 stat call emulation
Claus Gittinger <cg@exept.de>
parents: 2602
diff changeset
  5313
	WIN32_FIND_DATA findStruct;
68abf045b637 stat call emulation
Claus Gittinger <cg@exept.de>
parents: 2602
diff changeset
  5314
68abf045b637 stat call emulation
Claus Gittinger <cg@exept.de>
parents: 2602
diff changeset
  5315
	hFile = FindFirstFile(__stringVal(aPathName), &findStruct);
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5316
	if (! hFile) {
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5317
	    @global(LastErrorNumber) = __MKSMALLINT(WIN32_ERR(GetLastError()));
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5318
	    RETURN (nil);
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5319
	}
2609
68abf045b637 stat call emulation
Claus Gittinger <cg@exept.de>
parents: 2602
diff changeset
  5320
	FindClose(hFile);
68abf045b637 stat call emulation
Claus Gittinger <cg@exept.de>
parents: 2602
diff changeset
  5321
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  5322
	id = __MKSMALLINT(0);   /* could get it by opening ... */
2609
68abf045b637 stat call emulation
Claus Gittinger <cg@exept.de>
parents: 2602
diff changeset
  5323
	size = __MKLARGEINT64(1, findStruct.nFileSizeLow, findStruct.nFileSizeHigh);
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5324
2617
06d1b7337a33 added the alternativeName to the fileInfo (MSDOS name under NT)
Claus Gittinger <cg@exept.de>
parents: 2616
diff changeset
  5325
	bcopy(findStruct.cAlternateFileName, nameBuffer, 14);
06d1b7337a33 added the alternativeName to the fileInfo (MSDOS name under NT)
Claus Gittinger <cg@exept.de>
parents: 2616
diff changeset
  5326
	nameBuffer[14] = '\0';
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  5327
	name2 = __MKSTRING(nameBuffer); /* DOS name */
2617
06d1b7337a33 added the alternativeName to the fileInfo (MSDOS name under NT)
Claus Gittinger <cg@exept.de>
parents: 2616
diff changeset
  5328
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5329
	/*
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5330
	 * simulate access bits
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5331
	 */
2609
68abf045b637 stat call emulation
Claus Gittinger <cg@exept.de>
parents: 2602
diff changeset
  5332
	if (findStruct.dwFileAttributes & FILE_ATTRIBUTE_READONLY) {
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5333
	    modeBits = 0444;
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5334
	} else {
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5335
	    modeBits = 0666;
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5336
	}
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5337
2609
68abf045b637 stat call emulation
Claus Gittinger <cg@exept.de>
parents: 2602
diff changeset
  5338
	if (findStruct.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5339
	    type = @symbol(directory);
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5340
	    modeBits |= 0111;   /* executable */
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5341
	} else {
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5342
	    type = @symbol(regular);
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5343
	}
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5344
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5345
	mode = __MKSMALLINT(modeBits);
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5346
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5347
	/*
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5348
	 * sigh - convert from stupid time to useful time
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5349
	 */
2609
68abf045b637 stat call emulation
Claus Gittinger <cg@exept.de>
parents: 2602
diff changeset
  5350
	FileTimeToSystemTime(&(findStruct.ftCreationTime), &creationTime);
68abf045b637 stat call emulation
Claus Gittinger <cg@exept.de>
parents: 2602
diff changeset
  5351
	FileTimeToSystemTime(&(findStruct.ftLastAccessTime), &accessTime);
68abf045b637 stat call emulation
Claus Gittinger <cg@exept.de>
parents: 2602
diff changeset
  5352
	FileTimeToSystemTime(&(findStruct.ftLastWriteTime), &modificationTime);
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5353
	aYr  = __MKSMALLINT(accessTime.wYear);
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5354
	aMon = __MKSMALLINT(accessTime.wMonth);
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5355
	aDay = __MKSMALLINT(accessTime.wDay);
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5356
	aHr  = __MKSMALLINT(accessTime.wHour);
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5357
	aMin = __MKSMALLINT(accessTime.wMinute);
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5358
	aSec = __MKSMALLINT(accessTime.wSecond);
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5359
	aMS  = __MKSMALLINT(accessTime.wMilliseconds);
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5360
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5361
	mYr  = __MKSMALLINT(modificationTime.wYear);
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5362
	mMon = __MKSMALLINT(modificationTime.wMonth);
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5363
	mDay = __MKSMALLINT(modificationTime.wDay);
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5364
	mHr  = __MKSMALLINT(modificationTime.wHour);
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5365
	mMin = __MKSMALLINT(modificationTime.wMinute);
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5366
	mSec = __MKSMALLINT(modificationTime.wSecond);
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5367
	mMS  = __MKSMALLINT(modificationTime.wMilliseconds);
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5368
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5369
	cYr  = __MKSMALLINT(creationTime.wYear);
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5370
	cMon = __MKSMALLINT(creationTime.wMonth);
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5371
	cDay = __MKSMALLINT(creationTime.wDay);
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5372
	cHr  = __MKSMALLINT(creationTime.wHour);
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5373
	cMin = __MKSMALLINT(creationTime.wMinute);
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5374
	cSec = __MKSMALLINT(creationTime.wSecond);
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5375
	cMS  = __MKSMALLINT(creationTime.wMilliseconds);
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5376
#else /* not WIN32 */
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5377
# ifdef TRACE_STAT_CALLS
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5378
	printf("stat on '%s' for info\n", __stringVal(aPathName));
2912
d196f7a67d74 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2904
diff changeset
  5379
# endif
1885
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5380
	__BEGIN_INTERRUPTABLE__
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5381
	do {
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5382
	    ret = stat((char *) __stringVal(aPathName), &buf);
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5383
	} while ((ret < 0) && (errno == EINTR));
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5384
	__END_INTERRUPTABLE__
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5385
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5386
	if (ret < 0) {
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5387
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5388
	    RETURN ( nil );
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5389
	}
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5390
	switch (buf.st_mode & S_IFMT) {
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5391
	    case S_IFDIR:
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5392
		type = @symbol(directory);
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5393
		break;
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5394
1885
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5395
	    case S_IFREG:
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5396
		type = @symbol(regular);
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5397
		break;
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5398
# ifdef S_IFCHR
1885
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5399
	    case S_IFCHR:
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5400
		type = @symbol(characterSpecial);
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5401
		break;
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5402
# endif
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5403
# ifdef S_IFBLK
1885
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5404
	    case S_IFBLK:
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5405
		type = @symbol(blockSpecial);
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5406
		break;
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5407
# endif
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5408
# ifdef S_IFMPC
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5409
	    case S_IFMPC:
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5410
		type = @symbol(multiplexedCharacterSpecial);
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5411
		break;
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5412
# endif
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5413
# ifdef S_IFMPB
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5414
	    case S_IFMPB:
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5415
		type = @symbol(multiplexedBlockSpecial);
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5416
		break;
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5417
# endif
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5418
# ifdef S_IFLNK
1885
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5419
	    case S_IFLNK:
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5420
		type = @symbol(symbolicLink);
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5421
		break;
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5422
# endif
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5423
# ifdef S_IFSOCK
1885
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5424
	    case S_IFSOCK:
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5425
		type = @symbol(socket);
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5426
		break;
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5427
# endif
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5428
# ifdef S_IFIFO
1885
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5429
	    case S_IFIFO:
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5430
		type = @symbol(fifo);
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5431
		break;
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5432
# endif
1885
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5433
	    default:
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5434
		type = @symbol(unknown);
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5435
		break;
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5436
	}
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5437
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5438
# ifdef __openVMS__
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5439
#  ifndef _POSIX_C_SOURCE
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5440
	switch (buf.st_fab_rfm) {
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5441
	    case FAB$C_UDF:
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  5442
		/* undefined (also stream binary)   */
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5443
		recordFormat = @symbol(streamBinary);
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5444
		break;
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5445
	    case FAB$C_FIX:
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  5446
		/* fixed length records             */
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5447
		recordFormat = @symbol(fixedRecord);
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5448
		break;
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5449
	    case FAB$C_VAR:
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  5450
		/* variable length records          */
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5451
		recordFormat = @symbol(variableRecord);
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5452
		break;
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5453
	    case FAB$C_VFC:
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  5454
		/* variable fixed control           */
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5455
		recordFormat = @symbol(variableFixedControl);
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5456
		break;
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5457
	    case FAB$C_STM:
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  5458
		/* RMS-11 stream (valid only for sequen> */
2937
3f64925c9df3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2935
diff changeset
  5459
		recordFormat = @symbol(streamRMS11);
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5460
		break;
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5461
	    case FAB$C_STMLF:
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  5462
		/* LF stream (valid only for sequential> */
2937
3f64925c9df3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2935
diff changeset
  5463
		recordFormat = @symbol(streamLF);
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5464
		break;
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5465
	    case FAB$C_STMCR:
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  5466
		/* CR stream (valid only for sequential> */
2937
3f64925c9df3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2935
diff changeset
  5467
		recordFormat = @symbol(streamCR);
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5468
		break;
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5469
	    default:
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5470
		recordFormat = @symbol(unknown);
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5471
		break;
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5472
	}
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5473
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5474
	recordFormatNumeric = __MKSMALLINT(buf.st_fab_rfm);
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5475
	recordAttribs = __MKSMALLINT(buf.st_fab_rat);
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5476
	fixedHeaderSize = __MKSMALLINT(buf.st_fab_fsz);
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5477
	recordSize = __MKSMALLINT(buf.st_fab_mrs);
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5478
#  endif /* _POSIX_C_SOURCE */
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5479
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5480
#  ifdef alpha64
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5481
	ino = buf.st_ino[2];
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5482
	ino = (ino << 16) + buf.st_ino[1];
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5483
	ino = (ino << 16) + buf.st_ino[0];
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5484
	id = __MKUINT(ino);
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5485
#  else
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5486
	{
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5487
	    unsigned int inoHi, inoLow;
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5488
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5489
	    inoHi = buf.st_ino[2];
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5490
	    inoLow = buf.st_ino[1];
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5491
	    inoLow = (inoLow << 16) + buf.st_ino[0];
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5492
	    id = __MKLARGEINT64(1, inoLow, inoHi);
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5493
	}
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5494
#  endif
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5495
# else /* not VMS */
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5496
	ino = buf.st_ino;
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5497
	id = __MKUINT(ino);
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5498
# endif
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5499
1885
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5500
	mode = __MKSMALLINT(buf.st_mode & 0777);
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5501
	uid = __MKSMALLINT(buf.st_uid);
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5502
	gid = __MKSMALLINT(buf.st_gid);
2635
769fefb49ea8 care for gigaByte-sized files ...
Claus Gittinger <cg@exept.de>
parents: 2634
diff changeset
  5503
	size = __MKUINT(buf.st_size);
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5504
	aOStime = __MKUINT(buf.st_atime);
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5505
	mOStime = __MKUINT(buf.st_mtime);
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5506
	cOStime = __MKUINT(buf.st_ctime);
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5507
#endif /* no WIN32 */
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5508
    }
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5509
%}.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5510
    mode notNil ifTrue:[
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5511
	aOStime notNil ifTrue:[
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5512
	    atime := AbsoluteTime fromOSTime:(aOStime * 1000).
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5513
	    mtime := AbsoluteTime fromOSTime:(mOStime * 1000).
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5514
	    ctime := AbsoluteTime fromOSTime:(cOStime * 1000).
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5515
	] ifFalse:[
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5516
	    atime := AbsoluteTime day:aDay month:aMon year:aYr hour:aHr minutes:aMin seconds:aSec milliseconds:aMS.
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5517
	    mtime := AbsoluteTime day:mDay month:mMon year:mYr hour:mHr minutes:mMin seconds:mSec milliseconds:mMS.
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5518
	    ctime := AbsoluteTime day:cDay month:cMon year:cYr hour:cHr minutes:cMin seconds:cSec milliseconds:cMS.
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5519
	].
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5520
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5521
	info := FileStatusInfo
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  5522
		    type:type 
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  5523
		    mode:mode 
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  5524
		    uid:uid 
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  5525
		    gid:gid 
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  5526
		    size:size 
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  5527
		    id:id 
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  5528
		    accessed:atime 
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  5529
		    modified:mtime 
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  5530
		    statusChanged:ctime
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  5531
		    path:nil
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  5532
		    alternativeName:name2.
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5533
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5534
	recordFormat notNil ifTrue:[
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5535
	    "/ additional VMS info
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5536
	    info
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5537
		recordFormat:recordFormat
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5538
		recordFormatNumeric:recordFormatNumeric
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5539
		recordAttributes:recordAttribs
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5540
		fixedHeaderSize:fixedHeaderSize
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5541
		recordSize:recordSize
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5542
	].
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5543
	^ info
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5544
   ].
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  5545
   ^ self primitiveFailed
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5546
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5547
   "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5548
    OperatingSystem infoOf:'/'
1858
cbbc11c01e10 return a private object for fileInfo.
Claus Gittinger <cg@exept.de>
parents: 1845
diff changeset
  5549
    (OperatingSystem infoOf:'/') uid
cbbc11c01e10 return a private object for fileInfo.
Claus Gittinger <cg@exept.de>
parents: 1845
diff changeset
  5550
    (OperatingSystem infoOf:'/') accessed
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5551
   "
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  5552
!
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  5553
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5554
isDirectory:aPathName
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5555
    "return true, if 'aPathName' is a valid directory path name.
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  5556
     (i.e. exists and is a directory).
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  5557
     This also returns true for symbolic links pointing to a directory;
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  5558
     if you need to check for this, use #linkInfo:."
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  5559
1104
219a06128193 removed NOCONTEXT directives ...
Claus Gittinger <cg@exept.de>
parents: 1084
diff changeset
  5560
%{
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5561
    int ret;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5562
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5563
    if (__isString(aPathName)) {
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5564
#ifdef WIN32
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5565
	ret = GetFileAttributes((char *) __stringVal(aPathName));
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5566
	if (ret == -1) {
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5567
	    @global(LastErrorNumber) = __MKSMALLINT(WIN32_ERR(GetLastError()));
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5568
	    RETURN ( false );
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5569
	}
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5570
	RETURN ( (ret & FILE_ATTRIBUTE_DIRECTORY) ? true : false);
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5571
#else
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5572
	struct stat buf;
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5573
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5574
# ifdef TRACE_STAT_CALLS
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5575
	printf("stat on '%s' for isDirectory\n", __stringVal(aPathName));
2912
d196f7a67d74 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2904
diff changeset
  5576
# endif
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5577
	__BEGIN_INTERRUPTABLE__
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5578
	do {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5579
	    ret = stat((char *) __stringVal(aPathName), &buf);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5580
	} while ((ret < 0) && (errno == EINTR));
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5581
	__END_INTERRUPTABLE__
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5582
	if (ret < 0) {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5583
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5584
	    RETURN ( false );
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5585
	}
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5586
	RETURN ( ((buf.st_mode & S_IFMT) == S_IFDIR) ? true : false);
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5587
#endif
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5588
    }
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5589
%}.
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  5590
    ^ self primitiveFailed
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5591
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5592
    "an alternative implementation would be:
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5593
	^ (self infoOf:aPathName) type == #directory
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5594
    "
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  5595
!
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  5596
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5597
isExecutable:aPathName
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  5598
    "return true, if the given file is executable.
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  5599
     For symbolic links, the pointed-to-file is checked."
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  5600
1104
219a06128193 removed NOCONTEXT directives ...
Claus Gittinger <cg@exept.de>
parents: 1084
diff changeset
  5601
%{
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5602
    int ret;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5603
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5604
    if (__isString(aPathName)) {
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5605
# ifdef TRACE_ACCESS_CALLS
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5606
	printf("access on '%s' for executable\n", __stringVal(aPathName));
2912
d196f7a67d74 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2904
diff changeset
  5607
# endif
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5608
	__BEGIN_INTERRUPTABLE__
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5609
	do {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5610
	    ret = access(__stringVal(aPathName), X_OK);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5611
	} while ((ret < 0) && (errno == EINTR));
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5612
	__END_INTERRUPTABLE__
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5613
	if (ret < 0) {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5614
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5615
	}
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5616
	RETURN ( ((ret == 0) ? true : false) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5617
    }
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5618
%}.
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  5619
    ^ self primitiveFailed
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  5620
!
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  5621
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5622
isReadable:aPathName
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  5623
    "return true, if the file/dir 'aPathName' is readable.
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  5624
     For symbolic links, the pointed-to-file is checked."
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  5625
1104
219a06128193 removed NOCONTEXT directives ...
Claus Gittinger <cg@exept.de>
parents: 1084
diff changeset
  5626
%{
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5627
    int ret;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5628
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5629
    if (__isString(aPathName)) {
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5630
# ifdef TRACE_ACCESS_CALLS
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5631
	printf("access on '%s' for readable\n", __stringVal(aPathName));
2912
d196f7a67d74 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2904
diff changeset
  5632
# endif
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5633
	__BEGIN_INTERRUPTABLE__
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5634
	do {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5635
	    ret = access(__stringVal(aPathName), R_OK);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5636
	} while ((ret < 0) && (errno == EINTR));
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5637
	__END_INTERRUPTABLE__
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5638
	if (ret < 0) {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5639
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5640
	}
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5641
	RETURN ( ((ret == 0) ? true : false) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5642
    }
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5643
%}.
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  5644
    ^ self primitiveFailed
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  5645
!
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  5646
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5647
isSymbolicLink:aPathName
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5648
    "return true, if the given file is a symbolic link"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5649
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5650
    ^ (self linkInfoOf:aPathName) notNil
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5651
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5652
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5653
     OperatingSystem isSymbolicLink:'Make.proto'
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5654
     OperatingSystem isSymbolicLink:'Makefile' 
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5655
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5656
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5657
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5658
isValidPath:aPathName
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5659
    "return true, if 'aPathName' is a valid path name
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5660
     (i.e. the file or directory exists)"
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  5661
1104
219a06128193 removed NOCONTEXT directives ...
Claus Gittinger <cg@exept.de>
parents: 1084
diff changeset
  5662
%{
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5663
    struct stat buf;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5664
    int ret;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5665
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5666
    if (__isString(aPathName) || __isSymbol(aPathName) ) {
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5667
#ifdef WIN32
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5668
	ret = GetFileAttributes((char *) __stringVal(aPathName));
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5669
	if (ret == -1) {
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5670
	    RETURN ( false );
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5671
	}
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5672
	RETURN (true);
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5673
#else
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5674
# ifdef TRACE_STAT_CALLS
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5675
	printf("stat on '%s' for isValidPath\n", __stringVal(aPathName));
2912
d196f7a67d74 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2904
diff changeset
  5676
# endif
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5677
	__BEGIN_INTERRUPTABLE__
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5678
	do {
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  5679
	    ret = stat((char *) __stringVal(aPathName), &buf);
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5680
	} while ((ret < 0) && (errno == EINTR));
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5681
	__END_INTERRUPTABLE__
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5682
	if (ret < 0) {
2832
3b9900929fb3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2797
diff changeset
  5683
	    @global(OperatingSystem:LastErrorNumber) = __MKSMALLINT(errno);
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5684
	    RETURN (false);
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5685
	}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5686
	RETURN ( ret ? false : true );
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5687
#endif
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5688
    }
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  5689
%}.
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  5690
    ^ self primitiveFailed
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  5691
!
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  5692
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5693
isWritable:aPathName
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  5694
    "return true, if the given file is writable.
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  5695
     For symbolic links, the pointed-to-file is checked."
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  5696
1104
219a06128193 removed NOCONTEXT directives ...
Claus Gittinger <cg@exept.de>
parents: 1084
diff changeset
  5697
%{
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5698
    int ret;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5699
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5700
    if (__isString(aPathName)) {
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5701
#ifdef WIN32
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5702
	ret = GetFileAttributes((char *) __stringVal(aPathName));
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5703
	if (ret == -1) {
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5704
	    @global(LastErrorNumber) = __MKSMALLINT(WIN32_ERR(GetLastError()));
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5705
	    RETURN ( false );
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5706
	}
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5707
	RETURN ( (ret & FILE_ATTRIBUTE_READONLY) ? false : true);
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5708
#else
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5709
# ifdef TRACE_ACCESS_CALLS
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5710
	printf("access on '%s' for writable\n", __stringVal(aPathName));
2912
d196f7a67d74 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2904
diff changeset
  5711
# endif
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5712
	__BEGIN_INTERRUPTABLE__
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5713
	do {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5714
	    ret = access(__stringVal(aPathName), W_OK);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5715
	} while ((ret < 0) && (errno == EINTR));
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5716
	__END_INTERRUPTABLE__
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5717
	if (ret < 0) {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5718
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5719
	}
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  5720
	RETURN ( ((ret == 0) ? true : false) );
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5721
#endif
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5722
    }
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5723
%}.
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  5724
    ^ self primitiveFailed
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  5725
!
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  5726
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5727
linkInfoOf:aPathName
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5728
    "return a dictionary filled with info for the file 'aPathName',
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  5729
     IFF aPathName is a symbolic link. 
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  5730
     If aPathName is invalid, or its NOT a symbolic link, nil is returned.
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5731
     (which means, that systems like VMS or MSDOS always return nil here.)
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  5732
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5733
     The contents of the dictionary gives info about the link itself,
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5734
     on contrast to #infoOf:, which returns the info of the pointed to file
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5735
     in case of a symbolic link."
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5736
     
1499
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  5737
    |info type mode uid gid size id atime mtime ctime path|
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5738
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5739
%{  /* STACK: 1200 */
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5740
#if defined(S_IFLNK) && !defined(__openVMS__) && !defined(MSDOS_LIKE)
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5741
    struct stat buf;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5742
    int ret;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5743
    char pathBuffer[1024];
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5744
    unsigned INT ino;
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5745
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5746
    if (__isString(aPathName)) {
1885
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5747
	__BEGIN_INTERRUPTABLE__
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5748
	do {
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5749
	    ret = lstat((char *) __stringVal(aPathName), &buf);
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5750
	} while ((ret < 0) && (errno == EINTR));
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5751
	__END_INTERRUPTABLE__
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5752
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5753
	if (ret < 0) {
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5754
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5755
	    RETURN ( nil );
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5756
	}
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5757
	switch (buf.st_mode & S_IFMT) {
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5758
	    default:
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5759
		RETURN ( nil ); /* not a symbolic link */
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5760
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5761
	    case S_IFLNK:
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5762
		type = @symbol(symbolicLink);
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5763
		break;
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5764
	}
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5765
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5766
	ino = buf.st_ino;
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5767
	id = __MKUINT(ino);
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  5768
1885
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5769
	mode = __MKSMALLINT(buf.st_mode & 0777);
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5770
	uid = __MKSMALLINT(buf.st_uid);
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5771
	gid = __MKSMALLINT(buf.st_gid);
2635
769fefb49ea8 care for gigaByte-sized files ...
Claus Gittinger <cg@exept.de>
parents: 2634
diff changeset
  5772
	size = __MKUINT(buf.st_size);
1885
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5773
	atime = __MKUINT(buf.st_atime);
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5774
	mtime = __MKUINT(buf.st_mtime);
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5775
	ctime = __MKUINT(buf.st_ctime);
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5776
	if ((ret = readlink((char *) __stringVal(aPathName), pathBuffer, sizeof(pathBuffer))) < 0) {
2832
3b9900929fb3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2797
diff changeset
  5777
	    @global(OperatingSystem:LastErrorNumber) = __MKSMALLINT(errno);
1885
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5778
	    RETURN ( nil );
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5779
	} 
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5780
	pathBuffer[ret] = '\0';  /* readlink does not 0-terminate */
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5781
	path = __MKSTRING(pathBuffer);
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5782
    }
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  5783
#else
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  5784
    RETURN ( nil );
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  5785
#endif
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5786
%}.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5787
    mode notNil ifTrue:[
1885
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5788
	info := IdentityDictionary new.
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5789
	^ FileStatusInfo
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5790
	    type:type 
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5791
	    mode:mode 
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5792
	    uid:uid 
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5793
	    gid:gid 
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5794
	    size:size 
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5795
	    id:id 
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5796
	    accessed:(AbsoluteTime fromOSTime:(atime * 1000)) 
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5797
	    modified:(AbsoluteTime fromOSTime:(mtime * 1000)) 
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5798
	    statusChanged:(AbsoluteTime fromOSTime:(ctime * 1000))
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  5799
	    path:path
2617
06d1b7337a33 added the alternativeName to the fileInfo (MSDOS name under NT)
Claus Gittinger <cg@exept.de>
parents: 2616
diff changeset
  5800
	    alternativeName:nil
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5801
   ].
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  5802
   ^ self primitiveFailed
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5803
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5804
   "
1084
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  5805
    OperatingSystem infoOf:'Make.proto'  
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  5806
    OperatingSystem linkInfoOf:'Make.proto' 
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  5807
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  5808
    OperatingSystem infoOf:'resources/motif.style'   
d6ffc9368fd5 set LastErrorNumber; category changes
Claus Gittinger <cg@exept.de>
parents: 1076
diff changeset
  5809
    OperatingSystem linkInfoOf:'resources/motif.style' 
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5810
   "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5811
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5812
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5813
parentDirectoryName
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5814
    "return the name used to refer to parent directories.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5815
     In MSDOS, Unix and other systems this is '..', but maybe different
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5816
     for other systems.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5817
     (but those are currently not supported - so this is some
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5818
      preparation for the future)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5819
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5820
    ^ '..'
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  5821
!
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  5822
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5823
pathNameOf:pathName
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5824
    "return the pathName of the argument, aPathString,
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5825
     - thats the full pathname of the directory, starting at '/'.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5826
     This method needs the path to be valid
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5827
     (i.e. all directories must exist, be readable and executable).
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5828
     Notice: if symbolic links are involved, the result may look different
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5829
     from what you expect."
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5830
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5831
    |p path command|
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5832
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5833
    "some systems have a convenient function for this ..."
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5834
    path := self primPathNameOf:pathName.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5835
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5836
    path isNil ifTrue:[
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  5837
	(self isValidPath:pathName) ifFalse:[
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  5838
	    p := pathName.
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  5839
	    [(p size > 1)
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  5840
	     and:[p endsWith:(self fileSeparator)]
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  5841
	    ] whileTrue:[
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  5842
		p := p copyWithoutLast:1.
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  5843
	    ].
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  5844
	    ^ p
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  5845
	].
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  5846
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  5847
	(SlowFork==true or:[ForkFailed==true]) ifFalse:[
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5848
	    self isUNIXlike ifTrue:[
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  5849
		PipeStream openErrorSignal handle:[:ex |
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5850
		    ForkFailed := true.
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5851
		    'OperatingSystem [warning]: cannot fork/popen' errorPrintCR.
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5852
		    ex return.
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  5853
		] do:[
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5854
		    "have to fall back ..."
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5855
		    command := 'cd ' , pathName , '; pwd'.
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5856
		    p := PipeStream readingFrom:command.
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  5857
		].
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  5858
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  5859
		(p isNil or:[p atEnd]) ifTrue:[
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5860
		    ('OperatingSystem [warning]: PipeStream for <' , command , '> failed') errorPrintCR.
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  5861
		] ifFalse:[
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5862
		    path := p nextLine.
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5863
		    p close.
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  5864
		].
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5865
	    ]
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  5866
	].
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  5867
	path isNil ifTrue:[
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5868
	    "/
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5869
	    "/ return the original - there is nothing else can we do
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5870
	    "/
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  5871
	    path := pathName
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  5872
	].
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  5873
	(SlowFork==true or:[ForkFailed==true]) ifTrue:[
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  5874
	    path := self compressPath:path
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  5875
	]
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5876
    ].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5877
    ^ path.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5878
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5879
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5880
     OperatingSystem pathNameOf:'.'
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5881
     OperatingSystem pathNameOf:'../smalltalk/../smalltalk'
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5882
     OperatingSystem pathNameOf:'../../..'
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5883
     OperatingSystem pathNameOf:'..'
1799
0a2c5890f4f3 handle 'foo///' in directoryName
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  5884
     OperatingSystem pathNameOf:'/tmp////' 
0a2c5890f4f3 handle 'foo///' in directoryName
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  5885
     OperatingSystem pathNameOf:'/foo/bar' 
0a2c5890f4f3 handle 'foo///' in directoryName
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  5886
     OperatingSystem pathNameOf:'/foo/bar/'
0a2c5890f4f3 handle 'foo///' in directoryName
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  5887
     OperatingSystem pathNameOf:'/foo/bar//'
0a2c5890f4f3 handle 'foo///' in directoryName
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  5888
    "
0a2c5890f4f3 handle 'foo///' in directoryName
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  5889
1991
6dc27b78da3e Fix pathNameOf: for systems not supporting primPathNameOf:
Stefan Vogel <sv@exept.de>
parents: 1987
diff changeset
  5890
    "Modified: 29.11.1996 / 18:02:12 / stefan"
2139
54ab2e1f4d93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2131
diff changeset
  5891
    "Modified: 10.1.1997 / 19:10:42 / cg"
359
claus
parents: 357
diff changeset
  5892
!
claus
parents: 357
diff changeset
  5893
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5894
primPathNameOf:pathName
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5895
    "return the pathName of the argument, aPathString,
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5896
     - thats the full pathname of the directory, starting at '/'.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5897
     This method here returns nil, if the OS does not provide a
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5898
     realPath library function.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5899
     Notice: if symbolic links are involved, the result may look different
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5900
     from what you expect."
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5901
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5902
    |path|
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5903
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5904
%{  /* STACK: 16000 */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5905
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5906
    if (__isString(pathName)) {
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5907
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5908
#ifdef HAS_GETCWD
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5909
# if defined(UNIX_LIKE) ||defined(__VMS__) || defined(MSDOS_LIKE)
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5910
#  ifdef __VMS__
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5911
	if (strcmp(__stringVal(pathName), "[]") == 0) 
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5912
#  else
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5913
	if (strcmp(__stringVal(pathName), ".") == 0) 
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5914
#  endif
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5915
	{
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5916
	    char nameBuffer[MAXPATHLEN + 1];
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5917
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5918
	    if (@global(CurrentDirectory) == nil) {
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  5919
		if (getcwd(nameBuffer, MAXPATHLEN)) {
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5920
		    OBJ d;
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5921
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5922
		    @global(CurrentDirectory) = d = __MKSTRING(nameBuffer);
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5923
		    __GSTORE(d);
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5924
		}
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5925
	    }
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5926
	    RETURN (@global(CurrentDirectory));
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5927
	}
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5928
# endif /* UNIX_LIKE */
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5929
#endif /* HAS_GETCWD */
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5931
#ifdef HAS_REALPATH
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5932
	{
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  5933
	    char nameBuffer[MAXPATHLEN + 1 + MAXPATHLEN + 1];
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5934
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5935
	    if (realpath(__stringVal(pathName), nameBuffer)) {
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  5936
		RETURN ( __MKSTRING(nameBuffer) );
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5937
	    }
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  5938
	}
1632
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  5939
#else
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  5940
# ifdef WIN32
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5941
	{
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  5942
	    char nameBuffer[MAXPATHLEN + 1 + MAXPATHLEN + 1];
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  5943
	    char *pFinal;
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  5944
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  5945
	    if (GetFullPathName(__stringVal(pathName), sizeof(nameBuffer),
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  5946
				nameBuffer, &pFinal)) {
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  5947
		RETURN ( __MKSTRING(nameBuffer) );
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  5948
	    }
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5949
	}
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5950
# endif /* WIN32 */
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5951
#endif /* ! HAS_REALPATH */
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5952
    }
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5953
%}.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5954
    ^ nil
359
claus
parents: 357
diff changeset
  5955
!
claus
parents: 357
diff changeset
  5956
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5957
timeOfLastAccess:aPathName
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5958
    "return the time, when the file was last accessed.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5959
     For nonexistent files, nil is returned."
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5960
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5961
    "could be implemented as:
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5962
	(self infoOf:aPathName) accessed 
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5963
    "
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5964
    |osSeconds i|
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5965
%{
2949
6993ad758a9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
  5966
#if !defined(WIN32) && !defined(__VMS__)
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5967
    struct stat buf;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5968
    time_t mtime;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5969
    int ret;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5970
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5971
    if (__isString(aPathName)) {
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5972
# ifdef TRACE_STAT_CALLS
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  5973
	printf("stat on '%s' for timeOfLastAccess\n", __stringVal(aPathName));
2912
d196f7a67d74 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2904
diff changeset
  5974
# endif
1588
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  5975
	__BEGIN_INTERRUPTABLE__
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  5976
	do {
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  5977
	    ret = stat((char *) __stringVal(aPathName), &buf);
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  5978
	} while (ret < 0 && errno == EINTR);
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  5979
	__END_INTERRUPTABLE__
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  5980
	if (ret < 0) {
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  5981
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  5982
	    RETURN (nil);
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  5983
	}
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  5984
	osSeconds = __MKUINT(buf.st_atime);
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5985
    }
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5986
#endif
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  5987
%}.
1499
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  5988
    osSeconds notNil ifTrue:[^ AbsoluteTime fromOSTime:(osSeconds * 1000)].
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5989
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5990
    i := self infoOf:aPathName.
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5991
    i notNil ifTrue:[^ i accessed].
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  5992
    ^ nil.
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5993
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5994
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5995
     OperatingSystem timeOfLastAccess:'/'
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5996
    "
359
claus
parents: 357
diff changeset
  5997
!
claus
parents: 357
diff changeset
  5998
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  5999
timeOfLastChange:aPathName
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6000
    "return the time, when the file was last changed. 
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6001
     For nonexistent files, nil is returned."
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6002
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6003
    "could be implemented as:
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  6004
	(self infoOf:aPathName) modified
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  6005
    "
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  6006
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  6007
    |osSeconds i|
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6008
%{
2949
6993ad758a9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
  6009
#if !defined(WIN32) && !defined(__VMS__)
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6010
    struct stat buf;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6011
    int ret;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6012
    time_t mtime;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6013
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6014
    if (__isString(aPathName)) {
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6015
# ifdef TRACE_STAT_CALLS
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6016
	printf("stat on '%s' for timeOfLastChange\n", __stringVal(aPathName));
2912
d196f7a67d74 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2904
diff changeset
  6017
# endif
1588
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  6018
	__BEGIN_INTERRUPTABLE__
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  6019
	do {
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  6020
	    ret = stat((char *) __stringVal(aPathName), &buf);
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  6021
	} while (ret < 0 && errno == EINTR);
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  6022
	__END_INTERRUPTABLE__
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  6023
	if (ret < 0) {
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  6024
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  6025
	    RETURN ( nil );
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  6026
	}
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  6027
	osSeconds = __MKUINT(buf.st_mtime);
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6028
    }
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  6029
#endif
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  6030
%}.
1499
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  6031
    osSeconds notNil ifTrue:[^ AbsoluteTime fromOSTime:(osSeconds * 1000)].
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  6032
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  6033
    i := self infoOf:aPathName.
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  6034
    i notNil ifTrue:[^ i modified].
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  6035
    ^ nil.
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6036
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6037
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6038
     OperatingSystem timeOfLastChange:'/'
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6039
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6040
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6041
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6042
typeOf:aPathName
1858
cbbc11c01e10 return a private object for fileInfo.
Claus Gittinger <cg@exept.de>
parents: 1845
diff changeset
  6043
    "return the type of a file as a symbol; for nonexistent files,
cbbc11c01e10 return a private object for fileInfo.
Claus Gittinger <cg@exept.de>
parents: 1845
diff changeset
  6044
     nil is returned.
cbbc11c01e10 return a private object for fileInfo.
Claus Gittinger <cg@exept.de>
parents: 1845
diff changeset
  6045
     Notice: for symbolic links, the type of the pointed-to file is returned."
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6046
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  6047
    |i|
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  6048
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6049
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6050
     this could have been implemented as:
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  6051
	(self infoOf:aPathName) type 
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6052
     but for huge directory searches the code below is faster
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6053
    "
359
claus
parents: 357
diff changeset
  6054
1104
219a06128193 removed NOCONTEXT directives ...
Claus Gittinger <cg@exept.de>
parents: 1084
diff changeset
  6055
%{
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  6056
#ifndef WIN32
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6057
    struct stat buf;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6058
    int ret;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6059
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6060
    if (__isString(aPathName)) {
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6061
# ifdef TRACE_STAT_CALLS
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6062
	printf("stat on '%s' for type\n", __stringVal(aPathName));
2912
d196f7a67d74 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2904
diff changeset
  6063
# endif
1885
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  6064
	__BEGIN_INTERRUPTABLE__
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  6065
	do {
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  6066
	    ret = stat((char *) __stringVal(aPathName), &buf);
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  6067
	} while (ret < 0 && errno == EINTR);
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  6068
	__END_INTERRUPTABLE__
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  6069
	if (ret < 0) {
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  6070
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  6071
	    RETURN ( nil );
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  6072
	}
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  6073
	switch (buf.st_mode & S_IFMT) {
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  6074
	    case S_IFDIR:
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  6075
		RETURN ( @symbol(directory) );
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  6076
	    case S_IFREG:
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  6077
		RETURN ( @symbol(regular) );
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  6078
# ifdef S_IFCHR
1885
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  6079
	    case S_IFCHR:
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  6080
		RETURN ( @symbol(characterSpecial) );
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  6081
# endif
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  6082
# ifdef S_IFBLK
1885
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  6083
	    case S_IFBLK:
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  6084
		RETURN ( @symbol(blockSpecial) );
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  6085
# endif
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  6086
# ifdef S_IFLNK
1885
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  6087
	    case S_IFLNK:
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  6088
		RETURN ( @symbol(symbolicLink) );
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  6089
# endif
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  6090
# ifdef S_IFSOCK
1885
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  6091
	    case S_IFSOCK:
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  6092
		RETURN ( @symbol(socket) );
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  6093
# endif
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  6094
# ifdef S_IFIFO
1885
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  6095
	    case S_IFIFO:
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  6096
		RETURN ( @symbol(fifo) );
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  6097
# endif
1885
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  6098
	    default:
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  6099
		RETURN ( @symbol(unknown) );
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  6100
	}
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6101
    }
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  6102
#endif
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6103
%}.
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  6104
    i := self infoOf:aPathName.
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  6105
    i notNil ifTrue:[^ i type].
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  6106
    ^ nil.
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6107
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6108
    "
1858
cbbc11c01e10 return a private object for fileInfo.
Claus Gittinger <cg@exept.de>
parents: 1845
diff changeset
  6109
     OperatingSystem typeOf:'/'   
cbbc11c01e10 return a private object for fileInfo.
Claus Gittinger <cg@exept.de>
parents: 1845
diff changeset
  6110
     OperatingSystem typeOf:'.'   
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6111
     OperatingSystem typeOf:'Make.proto' 
1858
cbbc11c01e10 return a private object for fileInfo.
Claus Gittinger <cg@exept.de>
parents: 1845
diff changeset
  6112
     OperatingSystem typeOf:'resources/motif.style' 
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6113
    "
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6114
!
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6115
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6116
volumeNameOf:aPathString
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6117
    "return the volumeName of the argument, aPath
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6118
     - thats the name of the volume where aPath is.
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6119
     Not all OperatingSystems support/use volumes; on unix,
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6120
     this always returns an empty string."
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6121
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6122
    |idx|
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6123
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6124
    self isVMSlike ifTrue:[
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6125
	idx := aPathString indexOf:$:.
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6126
	idx ~~ 0 ifTrue:[
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6127
	    ^ aPathString copyTo:(idx - 1).
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6128
	].
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6129
	^ ''
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6130
    ].
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6131
    self isMSDOSlike ifTrue:[
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6132
	(aPathString at:2) == $: ifTrue:[
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6133
	    ^ (aPathString at:1) asString.
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6134
	]
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6135
    ].
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6136
    ^ ''
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6137
! !
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6138
1799
0a2c5890f4f3 handle 'foo///' in directoryName
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  6139
!OperatingSystem class methodsFor:'interrupts & signals'!
63
1f0cdefb013f *** empty log message ***
claus
parents: 51
diff changeset
  6140
10
claus
parents: 5
diff changeset
  6141
blockInterrupts
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  6142
    "disable interrupt processing - if disabled, incoming
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  6143
     interrupts will be registered and handled as soon as
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  6144
     interrupts are reenabled by OperatingSystemclass>>unblockInterrupts.
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  6145
     Returns the previous blocking status i.e. true if interrupts
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  6146
     where already blocked. You need this information for proper
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  6147
     unblocking, in case of nested block/unblock calls."
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  6148
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  6149
%{  /* NOCONTEXT */
710
10d86ca4c4a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 704
diff changeset
  6150
    RETURN ( __BLOCKINTERRUPTS() );
10
claus
parents: 5
diff changeset
  6151
%}
claus
parents: 5
diff changeset
  6152
!
claus
parents: 5
diff changeset
  6153
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6154
defaultSignal:signalNumber
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6155
    "revert to the default action on arrival of a (Unix-)signal.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6156
     Dont confuse Unix signals with smalltalk signals.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6157
     WARNING: for some signals, it is no good idea to revert to default;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6158
     for example, the default for SIGINT (i.e. ^C) is to exit; while the
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6159
     default for SIGQUIT (^ \) is to dump core.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6160
     Also, NOTICE that signal numbers are not portable between unix
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6161
     systems - use OperatingSystem sigXXX to get the numeric value for
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6162
     a signal."
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6163
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6164
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6165
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6166
    if (__isSmallInteger(signalNumber)) {
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6167
#ifdef SIG_DFL
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  6168
	signal(__intVal(signalNumber), SIG_DFL);
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6169
	RETURN (self);
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6170
#endif
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6171
    }
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6172
%}.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6173
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6174
     this error is triggered on non-integer argument
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6175
    "
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  6176
    ^ self primitiveFailed
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6177
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6178
    "you better save a snapshot image before trying this ..."
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6179
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6180
     'if you hit ^C now, Smalltalk will exit immediately' printNewline.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6181
     OperatingSystem defaultSignal:(OperatingSystem sigINT).
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6182
     1 to:1000000 do:[:i| ].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6183
     OperatingSystem enableSignal:(OperatingSystem sigINT).
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6184
     'normal ^C handling again.' printNewline
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6185
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6186
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6187
840
523533898acd Reset sigCHLD interrupt handler, when no more processes are being waited for.
Stefan Vogel <sv@exept.de>
parents: 832
diff changeset
  6188
disableChildSignalInterrupts
523533898acd Reset sigCHLD interrupt handler, when no more processes are being waited for.
Stefan Vogel <sv@exept.de>
parents: 832
diff changeset
  6189
    "disable childSignal interrupts 
523533898acd Reset sigCHLD interrupt handler, when no more processes are being waited for.
Stefan Vogel <sv@exept.de>
parents: 832
diff changeset
  6190
     (SIGCHLD, if the architecture supports it).
523533898acd Reset sigCHLD interrupt handler, when no more processes are being waited for.
Stefan Vogel <sv@exept.de>
parents: 832
diff changeset
  6191
     We have to set the signal back to default, because ignoring 
523533898acd Reset sigCHLD interrupt handler, when no more processes are being waited for.
Stefan Vogel <sv@exept.de>
parents: 832
diff changeset
  6192
     SIGCHLD breaks wait & co"
523533898acd Reset sigCHLD interrupt handler, when no more processes are being waited for.
Stefan Vogel <sv@exept.de>
parents: 832
diff changeset
  6193
523533898acd Reset sigCHLD interrupt handler, when no more processes are being waited for.
Stefan Vogel <sv@exept.de>
parents: 832
diff changeset
  6194
    ^ self defaultSignal:(self sigCHLD)
523533898acd Reset sigCHLD interrupt handler, when no more processes are being waited for.
Stefan Vogel <sv@exept.de>
parents: 832
diff changeset
  6195
523533898acd Reset sigCHLD interrupt handler, when no more processes are being waited for.
Stefan Vogel <sv@exept.de>
parents: 832
diff changeset
  6196
    "Created: 5.1.1996 / 15:45:28 / stefan"
523533898acd Reset sigCHLD interrupt handler, when no more processes are being waited for.
Stefan Vogel <sv@exept.de>
parents: 832
diff changeset
  6197
!
523533898acd Reset sigCHLD interrupt handler, when no more processes are being waited for.
Stefan Vogel <sv@exept.de>
parents: 832
diff changeset
  6198
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6199
disableIOInterruptsOn:fd
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6200
    "turn off IO interrupts for a filedescriptor"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6201
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6202
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6203
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6204
    int ret, flags, f;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6205
754
0dcc8af63497 Fix enableIoInterrupts for SYSV4.
Stefan Vogel <sv@exept.de>
parents: 714
diff changeset
  6206
#if (defined(F_GETFL) && defined(F_SETFL) && defined(FASYNC)) || defined(SYSV4)
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6207
    if (__isSmallInteger(fd)) {
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  6208
	f = __intVal(fd);
754
0dcc8af63497 Fix enableIoInterrupts for SYSV4.
Stefan Vogel <sv@exept.de>
parents: 714
diff changeset
  6209
# if defined(SYSV4)
759
908363ce8a32 interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 756
diff changeset
  6210
	ret = ioctl(f, I_SETSIG, 0);
754
0dcc8af63497 Fix enableIoInterrupts for SYSV4.
Stefan Vogel <sv@exept.de>
parents: 714
diff changeset
  6211
# else /*! SYSV4*/
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6212
	flags = fcntl(f, F_GETFL, 0);
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6213
	/*
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6214
	 * if already clear, there is no need for this syscall ...
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6215
	 */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6216
	if (flags & FASYNC) {
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6217
	    ret = fcntl(f, F_SETFL, flags & ~FASYNC);
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6218
	    if (ret >= 0) ret = flags;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6219
	} else {
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6220
	    ret = flags;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6221
	}
754
0dcc8af63497 Fix enableIoInterrupts for SYSV4.
Stefan Vogel <sv@exept.de>
parents: 714
diff changeset
  6222
# endif /* !SYSV4 */
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  6223
	RETURN ( __MKSMALLINT(ret) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6224
    }
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6225
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6226
%}.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6227
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6228
     this error is triggered on non-integer argument
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6229
     or if the OS does not support IO interrupts.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6230
    "
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  6231
    ^ self primitiveFailed
10
claus
parents: 5
diff changeset
  6232
!
claus
parents: 5
diff changeset
  6233
63
1f0cdefb013f *** empty log message ***
claus
parents: 51
diff changeset
  6234
disableSignal:signalNumber
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  6235
    "disable (Unix-) signal processing for signalNumber.
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  6236
     Dont confuse Unix signals with smalltalk signals.
63
1f0cdefb013f *** empty log message ***
claus
parents: 51
diff changeset
  6237
     WARNING: for some signals, it is no good idea to disable
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  6238
     them; for example, disabling the SIGINT signal turns off ^C
63
1f0cdefb013f *** empty log message ***
claus
parents: 51
diff changeset
  6239
     handling.
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6240
     Also, NOTICE that signal numbers are not portable between unix
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6241
     systems - use OperatingSystem sigXXX to get the numeric value for
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6242
     a signal.
63
1f0cdefb013f *** empty log message ***
claus
parents: 51
diff changeset
  6243
     Use only for fully debugged stand alone applications."
1f0cdefb013f *** empty log message ***
claus
parents: 51
diff changeset
  6244
1f0cdefb013f *** empty log message ***
claus
parents: 51
diff changeset
  6245
%{  /* NOCONTEXT */
1f0cdefb013f *** empty log message ***
claus
parents: 51
diff changeset
  6246
252
  6247
    if (__isSmallInteger(signalNumber)) {
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6248
	int sigNo = __intVal(signalNumber);
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6249
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6250
	if (sigNo == 0) {
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6251
	    RETURN (self);
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6252
	}
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6253
#ifdef SIG_IGN
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6254
	signal(sigNo, SIG_IGN);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  6255
	RETURN (self);
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6256
#endif
63
1f0cdefb013f *** empty log message ***
claus
parents: 51
diff changeset
  6257
    }
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6258
%}.
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6259
    "
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6260
     this error is triggered on non-integer argument
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6261
    "
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  6262
    ^ self primitiveFailed
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6263
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6264
    "
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6265
     'now, ^C is totally ignored ...' printNewline.
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6266
     OperatingSystem disableSignal:(OperatingSystem sigINT).
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6267
     1 to:1000000 do:[:i| ].
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6268
     OperatingSystem enableSignal:(OperatingSystem sigINT).
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6269
     '^C handled again.' printNewline
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6270
    "
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6271
!
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6272
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6273
disableTimer
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6274
    "disable timer interrupts.
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6275
     WARNING: 
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6276
	the system will not operate correctly with timer interrupts
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6277
	disabled, because no scheduling or timeouts are possible."
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6278
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6279
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6280
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6281
#if defined(ITIMER_REAL) && !defined(NO_SETITIMER)
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6282
    struct itimerval dt;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6283
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6284
    dt.it_interval.tv_sec = 0;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6285
    dt.it_interval.tv_usec = 0;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6286
    dt.it_value.tv_sec = 0;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6287
    dt.it_value.tv_usec = 0;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6288
    setitimer(ITIMER_REAL, &dt, 0);
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6289
    RETURN (true);
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6290
#else
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6291
# if defined(WIN32)
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6292
    extern void __win32ClearTimer();
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6293
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6294
    __win32ClearTimer();
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6295
    RETURN (true);
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6296
# endif /* WIN32 */
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6297
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6298
# if defined(__VMS__) && defined(USE_AST_TIMER)
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6299
    extern void __vmsClearTimer();
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6300
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6301
    __vmsClearTimer();
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6302
    RETURN (true);
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6303
# endif /* __VMS__ */
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6304
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6305
# if defined(USE_SLOW_ALARM)
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6306
#  if defined(SIGALRM)
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6307
    alarm(0);
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6308
    RETURN (true);
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6309
#  endif /* SIGALRM */
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6310
# endif
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6311
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6312
#endif
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6313
%}.
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6314
    ^ false
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6315
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6316
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6317
disableUserInterrupts
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6318
    "disable userInterrupt processing;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6319
     when disabled, no ^C processing takes place.
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6320
     WARNING:
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6321
	 If at all, use this only for debugged stand-alone applications, since
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6322
	 no exit to the debugger is possible with user interrupts disabled.
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6323
	 We recommend setting up a handler for the signal instead of disabling it."
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6324
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6325
    self disableSignal:(self sigBREAK).
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6326
    self disableSignal:(self sigINT).
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6327
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6328
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6329
enableAbortInterrupts
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6330
    "enable abort signalhandling, and make it a regular signalInterrupt.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6331
     (the default will dump core and exit - which is not a good idea for
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6332
      end-user applications ...).
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6333
     This is especially useful, if linked-in C-libraries call abort() ..."
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6334
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6335
    self enableSignal:(self sigABRT)
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6336
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6337
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6338
enableChildSignalInterrupts
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6339
    "enable childSignal interrupts 
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6340
     (SIGCHLD, if the architecture supports it).
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6341
     After enabling, these signals will send the message 
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6342
     'childSignalInterrupt' to the ChildSignalInterruptHandler object."
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6343
2959
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  6344
%{
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  6345
#ifdef __VMS__
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  6346
    extern void __vmsEnableChildInterrupts();
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  6347
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  6348
    __vmsEnableChildInterrupts();
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  6349
    RETURN(self);
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  6350
#endif
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  6351
%}.
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6352
    self enableSignal:(self sigCHLD)
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6353
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6354
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6355
enableFpExceptionInterrupts
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6356
    "enable floating point exception interrupts (if the
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6357
     architecture supports it).
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6358
     After enabling, fpu-exceptions will send the message 
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6359
     'fpuExceptionInterrupt' to the FPUExceptionInterruptHandler object."
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6360
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6361
    self enableSignal:(self sigFP)
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6362
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6363
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6364
enableHardSignalInterrupts
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6365
    "enable hard signal exception interrupts (trap, buserror & segm. violation).
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6366
     After enabling, these exceptions will send the message 
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6367
     'signalInterrupt' to the SignalInterruptHandler object."
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6368
855
2de3c842c687 dont use SIGPIPE - it leads to trouble if its executed asynchrounously or
Claus Gittinger <cg@exept.de>
parents: 843
diff changeset
  6369
    "/ leads to trouble ...
2de3c842c687 dont use SIGPIPE - it leads to trouble if its executed asynchrounously or
Claus Gittinger <cg@exept.de>
parents: 843
diff changeset
  6370
"/    self enableSignal:(self sigPIPE).
2de3c842c687 dont use SIGPIPE - it leads to trouble if its executed asynchrounously or
Claus Gittinger <cg@exept.de>
parents: 843
diff changeset
  6371
2de3c842c687 dont use SIGPIPE - it leads to trouble if its executed asynchrounously or
Claus Gittinger <cg@exept.de>
parents: 843
diff changeset
  6372
    "/ ... better to ignore them, and let it be handled as a writeErrorSignal.
2de3c842c687 dont use SIGPIPE - it leads to trouble if its executed asynchrounously or
Claus Gittinger <cg@exept.de>
parents: 843
diff changeset
  6373
    self disableSignal:(self sigPIPE).
2de3c842c687 dont use SIGPIPE - it leads to trouble if its executed asynchrounously or
Claus Gittinger <cg@exept.de>
parents: 843
diff changeset
  6374
1808
58ed32d318d4 handle SIGILL like bus or segv
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  6375
    self enableSignal:(self sigILL).
640
be94dfc60eaa Anforderung von SA_SIGINFO in sigaction.
Stefan Vogel <sv@exept.de>
parents: 630
diff changeset
  6376
    self enableSignal:(self sigBUS).
be94dfc60eaa Anforderung von SA_SIGINFO in sigaction.
Stefan Vogel <sv@exept.de>
parents: 630
diff changeset
  6377
    self enableSignal:(self sigSEGV)
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6378
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6379
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6380
enableIOInterruptsOn:fd
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6381
    "turn on IO interrupts for a filedescriptor"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6382
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6383
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6384
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6385
    int ret, flags, f;
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6386
#ifndef __signalIoInterrupt
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6387
    extern void __signalIoInterrupt();
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6388
#endif
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6389
    static int firstCall = 1;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6390
754
0dcc8af63497 Fix enableIoInterrupts for SYSV4.
Stefan Vogel <sv@exept.de>
parents: 714
diff changeset
  6391
#if (defined(F_GETFL) && defined(F_SETFL) && defined(FASYNC)) || defined(SYSV4)
0dcc8af63497 Fix enableIoInterrupts for SYSV4.
Stefan Vogel <sv@exept.de>
parents: 714
diff changeset
  6392
/*
0dcc8af63497 Fix enableIoInterrupts for SYSV4.
Stefan Vogel <sv@exept.de>
parents: 714
diff changeset
  6393
 * SIGIO/SIGPOLL - data available for I/O
0dcc8af63497 Fix enableIoInterrupts for SYSV4.
Stefan Vogel <sv@exept.de>
parents: 714
diff changeset
  6394
 * (used to wake up waiting processes)
0dcc8af63497 Fix enableIoInterrupts for SYSV4.
Stefan Vogel <sv@exept.de>
parents: 714
diff changeset
  6395
 */
0dcc8af63497 Fix enableIoInterrupts for SYSV4.
Stefan Vogel <sv@exept.de>
parents: 714
diff changeset
  6396
#ifdef SIGIO
0dcc8af63497 Fix enableIoInterrupts for SYSV4.
Stefan Vogel <sv@exept.de>
parents: 714
diff changeset
  6397
# define THESIGNAL SIGIO
0dcc8af63497 Fix enableIoInterrupts for SYSV4.
Stefan Vogel <sv@exept.de>
parents: 714
diff changeset
  6398
#else
0dcc8af63497 Fix enableIoInterrupts for SYSV4.
Stefan Vogel <sv@exept.de>
parents: 714
diff changeset
  6399
# ifdef SIGPOLL
0dcc8af63497 Fix enableIoInterrupts for SYSV4.
Stefan Vogel <sv@exept.de>
parents: 714
diff changeset
  6400
#  define THESIGNAL SIGPOLL
0dcc8af63497 Fix enableIoInterrupts for SYSV4.
Stefan Vogel <sv@exept.de>
parents: 714
diff changeset
  6401
# else
0dcc8af63497 Fix enableIoInterrupts for SYSV4.
Stefan Vogel <sv@exept.de>
parents: 714
diff changeset
  6402
#  ifdef SIGURG
0dcc8af63497 Fix enableIoInterrupts for SYSV4.
Stefan Vogel <sv@exept.de>
parents: 714
diff changeset
  6403
#   define THESIGNAL SIGURG
0dcc8af63497 Fix enableIoInterrupts for SYSV4.
Stefan Vogel <sv@exept.de>
parents: 714
diff changeset
  6404
#  endif
0dcc8af63497 Fix enableIoInterrupts for SYSV4.
Stefan Vogel <sv@exept.de>
parents: 714
diff changeset
  6405
# endif
0dcc8af63497 Fix enableIoInterrupts for SYSV4.
Stefan Vogel <sv@exept.de>
parents: 714
diff changeset
  6406
#endif
0dcc8af63497 Fix enableIoInterrupts for SYSV4.
Stefan Vogel <sv@exept.de>
parents: 714
diff changeset
  6407
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6408
    if (__isSmallInteger(fd)) {
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6409
	if (firstCall) {
762
cea705669628 ok, stefan was right: HAS_SIGACTION works
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
  6410
#ifdef HAS_SIGACTION
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6411
	    struct sigaction act;
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6412
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6413
	    /*
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6414
	     * Do not add SA_RESTART here. A signal can cause a
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6415
	     * thread switch, another thread can do a garbage collect
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6416
	     * and restarted system calls may write into old
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6417
	     * (collected) addresses.
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6418
	     */
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6419
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6420
	    act.sa_flags = SA_SIGINFO; /* <- if you add more, remember dummys at the top */
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6421
	    sigemptyset(&act.sa_mask);
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6422
	    act.sa_handler = __signalIoInterrupt;
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6423
	    sigaction(THESIGNAL, &act, 0);
754
0dcc8af63497 Fix enableIoInterrupts for SYSV4.
Stefan Vogel <sv@exept.de>
parents: 714
diff changeset
  6424
#else
766
9d6cc2cc834e igvec (SIGVEC) stuff added (for ultrix)
Claus Gittinger <cg@exept.de>
parents: 765
diff changeset
  6425
# ifdef HAS_SIGVEC
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6426
	    struct sigvec vec;
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6427
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6428
	    vec.sv_flags = SV_INTERRUPT;
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6429
	    sigemptyset(&vec.sv_mask);
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6430
	    vec.sv_handler = __signalIoInterrupt;
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6431
	    sigvec(THESIGNAL, &vec, NULL);
766
9d6cc2cc834e igvec (SIGVEC) stuff added (for ultrix)
Claus Gittinger <cg@exept.de>
parents: 765
diff changeset
  6432
# else
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6433
	    signal(THESIGNAL, __signalIoInterrupt);
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6434
# endif
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6435
#endif
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6436
	    firstCall = 0;
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6437
	}
754
0dcc8af63497 Fix enableIoInterrupts for SYSV4.
Stefan Vogel <sv@exept.de>
parents: 714
diff changeset
  6438
#undef THESIGNAL
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6439
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6440
	f = __intVal(fd);
754
0dcc8af63497 Fix enableIoInterrupts for SYSV4.
Stefan Vogel <sv@exept.de>
parents: 714
diff changeset
  6441
# if defined(SYSV4)
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6442
	ret = ioctl(f, I_SETSIG, S_INPUT | S_HIPRI | S_ERROR | S_RDNORM | S_RDBAND | S_MSG | S_HANGUP);
754
0dcc8af63497 Fix enableIoInterrupts for SYSV4.
Stefan Vogel <sv@exept.de>
parents: 714
diff changeset
  6443
# else /*! SYSV4*/
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6444
	flags = fcntl(f, F_GETFL, 0);
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6445
	/*
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6446
	 * if already set, there is no need for this syscall ...
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6447
	 */
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6448
	if (flags & FASYNC) {
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6449
	    ret = flags;
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6450
	} else {
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6451
	    ret = fcntl(f, F_SETFL, flags | FASYNC);
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6452
	    if (ret >= 0) ret = flags;
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6453
	}
754
0dcc8af63497 Fix enableIoInterrupts for SYSV4.
Stefan Vogel <sv@exept.de>
parents: 714
diff changeset
  6454
# endif /*!SYSV4*/
2834
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  6455
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  6456
#if defined(F_SETOWN) || defined(FIOSETOWN)
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6457
	{
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6458
	    int pid;
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6459
	    int ok;
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6460
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6461
	    pid = getpid();
2834
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  6462
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  6463
# if defined(F_SETOWN)
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6464
	    ok = fcntl(f, F_SETOWN, pid);
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6465
	    /* printf("F_SETOWN returns %d (%d)\n", ret, errno); */
2834
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  6466
# else
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6467
	    ok = ioctl(f, FIOSETOWN, &pid);
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6468
	    /* printf("FIOSETOWN returns %d (%d)\n", ret, errno); */
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6469
# endif
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6470
	    if (ok < 0) {
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6471
		ret = ok;
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6472
	    }
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6473
	}
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6474
#endif
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  6475
	RETURN ( __MKUINT(ret) );
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6476
    }
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6477
#endif
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6478
%}.
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6479
    "
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6480
     this error is triggered on non-integer argument
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6481
     or if the system does not support SIGIO
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6482
    "
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  6483
    ^ self primitiveFailed
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6484
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6485
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6486
enableQuitInterrupts
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6487
    "enable quitInterrupt (usually ^\) handling, and make it a userInterrupt.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6488
     (the default will dump core and exit - which is not a good idea for
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6489
      end-user applications ...)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6490
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6491
    self enableSignal:(self sigQUIT)
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6492
!
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6493
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6494
enableSignal:signalNumber
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  6495
    "enable (Unix-)signal processing for signalNumber.
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  6496
     Dont confuse Unix signals with smalltalk signals.
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6497
     The signal will be delivered to one of the standard handlers
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6498
     (SIGINT, SIGQUIT, etc) or to a general handler, which
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6499
     sends #signalInterrupt:.
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6500
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6501
     NOTICE that signal numbers are not portable between unix
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6502
     systems - use OperatingSystem sigXXX to get the numeric value for
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6503
     a signal."
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6504
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6505
%{  /* NOCONTEXT */
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6506
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6507
#ifdef NSIG
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6508
# define SIG_LIMIT NSIG
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6509
#else
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6510
# ifdef SIGUSR2
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6511
#  define SIG_LIMIT SIGUSR2
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6512
# else
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6513
#  ifdef SIGUSR
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6514
#   define SIG_LIMIT SIGUSR
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6515
#  endif
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6516
# endif
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6517
#endif
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6518
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6519
#if defined(SIGPOLL) && !defined(SIGIO)
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6520
# define SIGIO SIGPOLL
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6521
#endif
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6522
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6523
#ifdef SIGCHLD
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6524
# define CHILD_SIGNAL   SIGCHLD
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6525
#else
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6526
# ifdef SIGCLD
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6527
#  define CHILD_SIGNAL  SIGCLD
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6528
# endif
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6529
#endif
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6530
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6531
    int sigNr;
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  6532
#if defined(SIGINT) || defined(SIGQUIT)
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6533
# ifndef __signalUserInterrupt
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6534
    extern void __signalUserInterrupt(SIGHANDLER_ARG);
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6535
# endif
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  6536
#endif
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  6537
#ifdef SIGFPE
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6538
# ifndef __signalFpExceptionInterrupt
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6539
    extern void __signalFpExceptionInterrupt(SIGHANDLER_ARG);
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6540
# endif
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  6541
#endif
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  6542
#ifdef SIGIO
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6543
# ifndef __signalIoInterrupt
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6544
    extern void __signalIoInterrupt(SIGHANDLER_ARG);
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6545
# endif
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  6546
#endif
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6547
#ifdef CHILD_SIGNAL
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6548
# ifndef __signalChildInterrupt
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6549
    extern void __signalChildInterrupt(SIGHANDLER_ARG);
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6550
# endif
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6551
#endif
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  6552
#ifdef SIGPIPE
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6553
# ifndef __signalPIPEInterrupt
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6554
    extern void __signalPIPEInterrupt(SIGHANDLER_ARG);
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6555
# endif
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  6556
#endif
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  6557
#ifdef SIGBUS
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6558
# ifndef __signalBUSInterrupt
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6559
    extern void __signalBUSInterrupt(SIGHANDLER_ARG);
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6560
# endif
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  6561
#endif
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  6562
#ifdef SIGSEGV
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6563
# ifndef __signalSEGVInterrupt
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6564
    extern void __signalSEGVInterrupt(SIGHANDLER_ARG);
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6565
# endif
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  6566
#endif
1808
58ed32d318d4 handle SIGILL like bus or segv
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  6567
#ifdef SIGILL
58ed32d318d4 handle SIGILL like bus or segv
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  6568
# ifndef __signalTrapInterrupt
58ed32d318d4 handle SIGILL like bus or segv
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  6569
    extern void __signalTrapInterrupt(SIGHANDLER_ARG);
58ed32d318d4 handle SIGILL like bus or segv
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  6570
# endif
58ed32d318d4 handle SIGILL like bus or segv
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  6571
#endif
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  6572
#ifdef SIGALRM
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6573
# ifndef WIN32
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6574
#  ifndef __signalTimerInterrupt
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6575
    extern void __signalTimerInterrupt(SIGHANDLER_ARG);
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6576
#  endif
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6577
# endif
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6578
#endif
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6579
#ifndef __signalInterrupt
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6580
    extern void __signalInterrupt(SIGHANDLER_ARG);
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6581
#endif
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6582
    void (*handler)(SIGHANDLER_ARG);
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6583
252
  6584
    if (__isSmallInteger(signalNumber)
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  6585
     && ((sigNr = __intVal(signalNumber)) >= 0)
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6586
#ifdef SIG_LIMIT
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6587
     &&  (sigNr <= SIG_LIMIT)
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6588
#endif
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6589
    ) {
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  6590
	/*
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  6591
	 * standard signals are forced into standard handlers
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  6592
	 * - all others go into general signalInterrupt
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  6593
	 */
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6594
#if defined(SIGPOLL) && defined(SIGIO)
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  6595
	if (sigNr == SIGPOLL)
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  6596
	    sigNr = SIGIO;
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6597
#endif
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  6598
	switch (sigNr) {
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6599
	    case 0:
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6600
		/* enabling a non-supported signal */
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6601
		RETURN (self);
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6602
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6603
#ifdef SIGBREAK
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6604
	    case SIGBREAK:
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6605
#endif
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  6606
#ifdef SIGINT
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  6607
	    case SIGINT:
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  6608
#endif
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  6609
#ifdef SIGQUIT
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  6610
	    case SIGQUIT:
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  6611
#endif
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6612
#if defined(SIGINT) || defined(SIGQUIT) || defined(SIGBREAK)
329
claus
parents: 322
diff changeset
  6613
		handler = __signalUserInterrupt;
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  6614
		break;
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  6615
#endif
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  6616
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  6617
#ifdef SIGFPE
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  6618
	    case SIGFPE:
329
claus
parents: 322
diff changeset
  6619
		handler = __signalFpExceptionInterrupt;
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  6620
		break;
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  6621
#endif
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  6622
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  6623
#ifdef SIGPIPE
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  6624
	    case SIGPIPE:
329
claus
parents: 322
diff changeset
  6625
		handler = __signalPIPEInterrupt;
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  6626
		break;
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  6627
#endif
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6628
#ifdef SIGBUS
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  6629
	    case SIGBUS:
329
claus
parents: 322
diff changeset
  6630
		handler = __signalBUSInterrupt;
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  6631
		break;
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6632
#endif
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  6633
#ifdef SIGSEGV
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  6634
	    case SIGSEGV:
329
claus
parents: 322
diff changeset
  6635
		handler = __signalSEGVInterrupt;
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  6636
		break;
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  6637
#endif
1982
8d4f97279e55 oops - SIGILL was never cought
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  6638
#ifdef SIGILL
8d4f97279e55 oops - SIGILL was never cought
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  6639
	    case SIGILL:
1808
58ed32d318d4 handle SIGILL like bus or segv
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  6640
		handler = __signalTrapInterrupt;
58ed32d318d4 handle SIGILL like bus or segv
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  6641
		break;
58ed32d318d4 handle SIGILL like bus or segv
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  6642
#endif
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6643
#ifdef SIGIO
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  6644
	    case SIGIO:
329
claus
parents: 322
diff changeset
  6645
		handler = __signalIoInterrupt;
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  6646
		break;
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6647
#endif
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6648
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6649
#ifdef CHILD_SIGNAL
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  6650
	    case CHILD_SIGNAL:
329
claus
parents: 322
diff changeset
  6651
		handler = __signalChildInterrupt;
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  6652
		break;
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6653
#endif
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  6654
#ifdef SIGALRM
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6655
# ifndef WIN32
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  6656
	    case SIGALRM:
329
claus
parents: 322
diff changeset
  6657
		handler = __signalTimerInterrupt;
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  6658
		break;
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6659
# endif
443
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  6660
#endif
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  6661
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  6662
	    default:
329
claus
parents: 322
diff changeset
  6663
		handler = __signalInterrupt;
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  6664
		break;
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  6665
	}
766
9d6cc2cc834e igvec (SIGVEC) stuff added (for ultrix)
Claus Gittinger <cg@exept.de>
parents: 765
diff changeset
  6666
9d6cc2cc834e igvec (SIGVEC) stuff added (for ultrix)
Claus Gittinger <cg@exept.de>
parents: 765
diff changeset
  6667
	{
762
cea705669628 ok, stefan was right: HAS_SIGACTION works
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
  6668
#ifdef HAS_SIGACTION
813
1f9611434418 first stuff for locale support added
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6669
	    struct sigaction act;
766
9d6cc2cc834e igvec (SIGVEC) stuff added (for ultrix)
Claus Gittinger <cg@exept.de>
parents: 765
diff changeset
  6670
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  6671
	    /*
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  6672
	     * Do not add SA_RESTART here. A signal can cause a
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  6673
	     * thread switch, another thread can do a garbage collect
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  6674
	     * and restarted system calls may write into old
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  6675
	     * (collected) addresses.
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  6676
	     */
1062
baa5827a7a40 Do not transparently restart system calls after a (Unix-)signal.
Stefan Vogel <sv@exept.de>
parents: 1060
diff changeset
  6677
baa5827a7a40 Do not transparently restart system calls after a (Unix-)signal.
Stefan Vogel <sv@exept.de>
parents: 1060
diff changeset
  6678
	    act.sa_flags = SA_SIGINFO; /* <- if you add more, remember dummys at the top */
766
9d6cc2cc834e igvec (SIGVEC) stuff added (for ultrix)
Claus Gittinger <cg@exept.de>
parents: 765
diff changeset
  6679
	    sigemptyset(&act.sa_mask);
9d6cc2cc834e igvec (SIGVEC) stuff added (for ultrix)
Claus Gittinger <cg@exept.de>
parents: 765
diff changeset
  6680
	    act.sa_handler = handler;
9d6cc2cc834e igvec (SIGVEC) stuff added (for ultrix)
Claus Gittinger <cg@exept.de>
parents: 765
diff changeset
  6681
	    sigaction(sigNr, &act, 0);
213
3b56a17534fd *** empty log message ***
claus
parents: 204
diff changeset
  6682
#else
766
9d6cc2cc834e igvec (SIGVEC) stuff added (for ultrix)
Claus Gittinger <cg@exept.de>
parents: 765
diff changeset
  6683
# ifdef HAS_SIGVEC
813
1f9611434418 first stuff for locale support added
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6684
	    struct sigvec vec;
1f9611434418 first stuff for locale support added
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6685
1062
baa5827a7a40 Do not transparently restart system calls after a (Unix-)signal.
Stefan Vogel <sv@exept.de>
parents: 1060
diff changeset
  6686
	    vec.sv_flags = SV_INTERRUPT;
813
1f9611434418 first stuff for locale support added
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6687
	    sigemptyset(&vec.sv_mask);
1f9611434418 first stuff for locale support added
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6688
	    vec.sv_handler = handler;
1f9611434418 first stuff for locale support added
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6689
	    sigvec(sigNr, &vec, NULL);
766
9d6cc2cc834e igvec (SIGVEC) stuff added (for ultrix)
Claus Gittinger <cg@exept.de>
parents: 765
diff changeset
  6690
# else
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6691
	    (void) signal(sigNr, handler);
766
9d6cc2cc834e igvec (SIGVEC) stuff added (for ultrix)
Claus Gittinger <cg@exept.de>
parents: 765
diff changeset
  6692
# endif
9d6cc2cc834e igvec (SIGVEC) stuff added (for ultrix)
Claus Gittinger <cg@exept.de>
parents: 765
diff changeset
  6693
#endif
9d6cc2cc834e igvec (SIGVEC) stuff added (for ultrix)
Claus Gittinger <cg@exept.de>
parents: 765
diff changeset
  6694
	}
213
3b56a17534fd *** empty log message ***
claus
parents: 204
diff changeset
  6695
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  6696
	/*
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  6697
	 * maybe, we should return the old enable-status
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  6698
	 * as boolean here ...
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  6699
	 */
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  6700
	RETURN (self);
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6701
    }
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6702
%}.
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6703
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6704
    "
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6705
     this error is triggered on non-integer argument, or
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6706
     if the signal number is not in the valid range (1..NSIG)
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6707
    "
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  6708
    ^ self primitiveFailed
63
1f0cdefb013f *** empty log message ***
claus
parents: 51
diff changeset
  6709
!
1f0cdefb013f *** empty log message ***
claus
parents: 51
diff changeset
  6710
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6711
enableTimer:milliSeconds
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6712
    "setup for a timerInterrupt, to be signalled after some (real) time."
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6713
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6714
%{  /* NOCONTEXT */
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6715
    int millis;
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6716
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6717
    millis = __intVal(milliSeconds);
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6718
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6719
#ifdef SIGALRM
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6720
    {
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6721
	static int firstCall = 1;
2631
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  6722
# ifndef __signalTimerInterrupt
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  6723
	extern void __signalTimerInterrupt(SIGHANDLER_ARG);
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  6724
# endif
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  6725
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  6726
	if (firstCall) {
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6727
# ifdef HAS_SIGACTION
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6728
	    struct sigaction act;
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6729
1062
baa5827a7a40 Do not transparently restart system calls after a (Unix-)signal.
Stefan Vogel <sv@exept.de>
parents: 1060
diff changeset
  6730
	    act.sa_flags = SA_SIGINFO; /* <- if you add more, remember dummys at the top */
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6731
	    sigemptyset(&act.sa_mask);
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6732
	    act.sa_handler = __signalTimerInterrupt;
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6733
	    sigaction(SIGALRM, &act, 0);
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6734
# else
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6735
#  ifdef HAS_SIGVEC
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6736
	    struct sigvec vec;
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6737
1062
baa5827a7a40 Do not transparently restart system calls after a (Unix-)signal.
Stefan Vogel <sv@exept.de>
parents: 1060
diff changeset
  6738
	    vec.sv_flags = SV_INTERRUPT;
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6739
	    sigemptyset(&vec.sv_mask);
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6740
	    vec.sv_handler = __signalTimerInterrupt;
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6741
	    sigvec(SIGALRM, &vec, NULL);
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6742
#  else /* neither SIGACTION nor SIGVEC */
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6743
	    signal(SIGALRM, __signalTimerInterrupt);
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6744
#  endif /* stupid system  */
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6745
# endif
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6746
	    firstCall = 0;
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6747
	}
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6748
    }
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6749
#endif /* SIGALRM */
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6750
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6751
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6752
#if defined(ITIMER_REAL) && !defined(NO_SETITIMER)
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6753
    {
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6754
	struct itimerval dt;
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6755
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6756
	dt.it_interval.tv_sec = 0;
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6757
	dt.it_interval.tv_usec = 0;
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6758
	dt.it_value.tv_sec = millis / 1000;
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6759
	dt.it_value.tv_usec = (millis % 1000) * 1000;  
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6760
	setitimer(ITIMER_REAL, &dt, 0);
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6761
	RETURN (true);
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6762
    }
2631
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  6763
#else /* no ITIMER_REAL */
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6764
# ifdef WIN32
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6765
    {
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  6766
	extern void __win32SetTimer();
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  6767
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  6768
	__win32SetTimer(millis);
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  6769
	RETURN (true);
640
be94dfc60eaa Anforderung von SA_SIGINFO in sigaction.
Stefan Vogel <sv@exept.de>
parents: 630
diff changeset
  6770
    }
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6771
# endif /* WIN32 */
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6772
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6773
# if defined(__VMS__) && defined(USE_AST_TIMER)
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6774
    {
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6775
	extern void __vmsSetTimer();
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6776
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6777
	__vmsSetTimer(millis);
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6778
	RETURN (true);
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6779
    }
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6780
# endif /* __VMS__ */
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6781
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6782
# ifdef USE_SLOW_ALARM
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6783
    {
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6784
	/*
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6785
	 * last fallback - use alarm (which only gives 1 second resolution).
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6786
	 * If the system does not support any of the above, you have to life
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6787
	 * with this. The consequence is that pressing CTRL-C processing and
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6788
	 * thread switching will take place much delayed.
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6789
	 */
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6790
	alarm(1);
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6791
	RETURN(true);
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6792
    }
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  6793
# endif
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6794
#endif /* ITIMER_REAL */
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6795
%}.
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6796
    ^ false
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6797
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6798
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6799
enableUserInterrupts
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6800
    "enable userInterrupt (^C) handling;
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  6801
     when enabled, ^C in the terminal window will send the message
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  6802
     'userInterrupt' to the UserInterruptHandler object."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6803
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6804
    self enableSignal:(self sigINT).
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  6805
    self enableSignal:(self sigBREAK).
63
1f0cdefb013f *** empty log message ***
claus
parents: 51
diff changeset
  6806
!
1f0cdefb013f *** empty log message ***
claus
parents: 51
diff changeset
  6807
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6808
interruptPending
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6809
    "return true, if an interrupt is pending. The returned value is
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6810
     invalid if interrupts are not currently blocked, since otherwise 
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6811
     the interrupt is usually already handled before arriving here,
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6812
     or may be served while returning from here."
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6813
2117
460b14a6db96 added a query for interrupts being blocked
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  6814
%{  /* NOCONTEXT */
460b14a6db96 added a query for interrupts being blocked
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  6815
    extern OBJ __INTERRUPTPENDING();
460b14a6db96 added a query for interrupts being blocked
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  6816
460b14a6db96 added a query for interrupts being blocked
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  6817
    RETURN ( __INTERRUPTPENDING() );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6818
%}        
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6819
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6820
2117
460b14a6db96 added a query for interrupts being blocked
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  6821
interruptsBlocked
460b14a6db96 added a query for interrupts being blocked
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  6822
    "return true, if interrupt handling is currently disabled;
460b14a6db96 added a query for interrupts being blocked
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  6823
     false otherwise."
460b14a6db96 added a query for interrupts being blocked
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  6824
460b14a6db96 added a query for interrupts being blocked
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  6825
%{  /* NOCONTEXT */
460b14a6db96 added a query for interrupts being blocked
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  6826
    extern OBJ __INTERRUPTS_BLOCKED();
460b14a6db96 added a query for interrupts being blocked
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  6827
460b14a6db96 added a query for interrupts being blocked
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  6828
    RETURN ( __INTERRUPTS_BLOCKED() );
460b14a6db96 added a query for interrupts being blocked
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  6829
%}
460b14a6db96 added a query for interrupts being blocked
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  6830
!
460b14a6db96 added a query for interrupts being blocked
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
  6831
704
42cb0141808d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 676
diff changeset
  6832
killProcess:processId
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  6833
    "kill a unix process.
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6834
     The process terminates immediately and has no chance to perform any cleanup actions.
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6835
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6836
     WARNING: in order to avoid zombie processes (on unix),
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6837
	      you have to fetch the processes exitstatus with
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6838
	      OperatingSystem>>getStatusOfProcess:aProcessId."
704
42cb0141808d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 676
diff changeset
  6839
42cb0141808d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 676
diff changeset
  6840
    self sendSignal:(self sigKILL) to:processId.
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  6841
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  6842
    "Modified: 28.12.1995 / 15:06:18 / stefan"
704
42cb0141808d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 676
diff changeset
  6843
!
42cb0141808d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 676
diff changeset
  6844
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6845
nameForSignal:aSignalNumber
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6846
    "for a given Unix signalnumber, return a descriptive string"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6847
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6848
    aSignalNumber == self sigHUP    ifTrue:[^ 'hangup'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6849
    aSignalNumber == self sigINT    ifTrue:[^ 'interrupt'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6850
    aSignalNumber == self sigKILL   ifTrue:[^ 'kill'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6851
    aSignalNumber == self sigQUIT   ifTrue:[^ 'quit'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6852
    aSignalNumber == self sigILL    ifTrue:[^ 'illegal instruction'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6853
    aSignalNumber == self sigTRAP   ifTrue:[^ 'trap'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6854
    aSignalNumber == self sigABRT   ifTrue:[^ 'abort'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6855
    aSignalNumber == self sigIOT    ifTrue:[^ 'iot trap'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6856
    aSignalNumber == self sigEMT    ifTrue:[^ 'emt trap'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6857
    aSignalNumber == self sigFP     ifTrue:[^ 'fp exception'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6858
    aSignalNumber == self sigBUS    ifTrue:[^ 'bus error'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6859
    aSignalNumber == self sigSEGV   ifTrue:[^ 'segmentation violation'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6860
    aSignalNumber == self sigSYS    ifTrue:[^ 'bad system call'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6861
    aSignalNumber == self sigPIPE   ifTrue:[^ 'broken pipe'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6862
    aSignalNumber == self sigALRM   ifTrue:[^ 'alarm timer'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6863
    aSignalNumber == self sigTERM   ifTrue:[^ 'termination'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6864
    aSignalNumber == self sigSTOP   ifTrue:[^ 'stop'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6865
    aSignalNumber == self sigTSTP   ifTrue:[^ 'tty stop'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6866
    aSignalNumber == self sigCONT   ifTrue:[^ 'continue'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6867
    aSignalNumber == self sigCHLD   ifTrue:[^ 'child death'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6868
    aSignalNumber == self sigTTIN   ifTrue:[^ 'background tty input'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6869
    aSignalNumber == self sigTTOU   ifTrue:[^ 'background tty output'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6870
    aSignalNumber == self sigIO     ifTrue:[^ 'io available'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6871
    aSignalNumber == self sigXCPU   ifTrue:[^ 'cpu time expired'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6872
    aSignalNumber == self sigXFSZ   ifTrue:[^ 'file size limit'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6873
    aSignalNumber == self sigVTALRM ifTrue:[^ 'virtual alarm timer'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6874
    aSignalNumber == self sigPROF   ifTrue:[^ 'profiling timer'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6875
    aSignalNumber == self sigWINCH  ifTrue:[^ 'winsize changed'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6876
    aSignalNumber == self sigLOST   ifTrue:[^ 'resource lost'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6877
    aSignalNumber == self sigUSR1   ifTrue:[^ 'user signal 1'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6878
    aSignalNumber == self sigUSR2   ifTrue:[^ 'user signal 2'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6879
    aSignalNumber == self sigMSG    ifTrue:[^ 'HFT message'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6880
    aSignalNumber == self sigPWR    ifTrue:[^ 'power-fail'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6881
    aSignalNumber == self sigPRE    ifTrue:[^ 'programming exception'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6882
    aSignalNumber == self sigGRANT  ifTrue:[^ 'HFT access wanted'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6883
    aSignalNumber == self sigRETRACT ifTrue:[^ 'HFT access relinquish'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6884
    aSignalNumber == self sigSOUND   ifTrue:[^ 'HFT sound complete'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6885
    aSignalNumber == self sigDANGER  ifTrue:[^ 'low on paging space'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6886
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6887
    "notice: many systems map SIGPOLL and/or SIGUSR onto SIGIO
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6888
	     therefore, keep SIGIO always above the two below" 
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6889
    aSignalNumber == self sigPOLL   ifTrue:[^ 'io available'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6890
    aSignalNumber == self sigURG    ifTrue:[^ 'urgent'].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6891
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6892
    ^ 'unknown signal'
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6893
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6894
    "
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6895
     OperatingSystem nameForSignal:9
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6896
     OperatingSystem nameForSignal:(OperatingSystem sigPOLL) 
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6897
    "
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6898
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6899
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6900
operatingSystemSignal:signalNumber
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6901
    "return the signal to be raised when an 
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6902
     operatingSystem-signal occurs, or nil"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6903
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6904
    OSSignals notNil ifTrue:[
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6905
	^ OSSignals at:signalNumber ifAbsent:[nil]
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6906
    ].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6907
    ^ nil
10
claus
parents: 5
diff changeset
  6908
!
claus
parents: 5
diff changeset
  6909
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6910
operatingSystemSignal:signalNumber install:aSignal
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6911
    "install a signal to be raised when an operatingSystem-signal occurs"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6912
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6913
    OSSignals isNil ifTrue:[
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6914
	OSSignals := Array new:32
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6915
    ].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6916
    OSSignals at:signalNumber put:aSignal
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6917
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6918
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6919
sendSignal:signalNumber to:processId
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6920
    "send a unix signal to some process (maybe myself).
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6921
     Returns false if any error occurred, true otherwise.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6922
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6923
     Do not confuse UNIX signals with Smalltalk-Signals.
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6924
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6925
     WARNING: in order to avoid zombie processes (on unix),
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6926
	      you may have to fetch the processes exitstatus with
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6927
	      OperatingSystem>>getStatusOfProcess:aProcessId
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6928
	      if the signal terminates that process."
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6929
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6930
%{
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  6931
#ifndef MSDOS_LIKE
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6932
    if (__bothSmallInteger(signalNumber, processId)) {
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6933
	if (kill(__intVal(processId), __intVal(signalNumber)) < 0) {
2832
3b9900929fb3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2797
diff changeset
  6934
	    @global(OperatingSystem:LastErrorNumber) = __MKSMALLINT(errno);
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6935
	    RETURN ( false );
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
  6936
	}
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  6937
	RETURN ( true );
10
claus
parents: 5
diff changeset
  6938
    }
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  6939
#endif
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6940
%}.
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  6941
    "/
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  6942
    "/ either invalid argument (non-integers)
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  6943
    "/ or not supported by OS
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  6944
    "/
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  6945
    ^ self primitiveFailed
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6946
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6947
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6948
startSpyTimer
63
1f0cdefb013f *** empty log message ***
claus
parents: 51
diff changeset
  6949
    "trigger a spyInterrupt, to be signalled after some short (virtual) time.
359
claus
parents: 357
diff changeset
  6950
     This is used by the old MessageTally for profiling.
63
1f0cdefb013f *** empty log message ***
claus
parents: 51
diff changeset
  6951
     Should be changed to use real profiling timer if available.
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  6952
     On systems, where no virtual timer is available, use the real timer
359
claus
parents: 357
diff changeset
  6953
     (which is of course less correct).
claus
parents: 357
diff changeset
  6954
     OBSOLETE: the new messageTally runs as a high prio process, not using 
claus
parents: 357
diff changeset
  6955
	       spy interrupts."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6956
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6957
%{  /* NOCONTEXT */
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6958
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6959
#ifndef __spyInterrupt
329
claus
parents: 322
diff changeset
  6960
    extern void __spyInterrupt();
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  6961
#endif
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6962
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6963
#if defined(ITIMER_VIRTUAL) && !defined(NO_SETITIMER)
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6964
    struct itimerval dt;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6965
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  6966
# ifdef SIGVTALRM
329
claus
parents: 322
diff changeset
  6967
    signal(SIGVTALRM, __spyInterrupt);
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  6968
# else
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6969
#  ifdef SIGALRM
329
claus
parents: 322
diff changeset
  6970
    signal(SIGALRM, __spyInterrupt);
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6971
#  else
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6972
    /*
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6973
     * mhmh - system has neither SIGBTALRM nor SIGALRM ...
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6974
     * what should we do here ?
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6975
     */
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6976
#  endif
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  6977
# endif
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  6978
348
claus
parents: 345
diff changeset
  6979
    dt.it_interval.tv_sec = 0;
claus
parents: 345
diff changeset
  6980
    dt.it_interval.tv_usec = 0;
claus
parents: 345
diff changeset
  6981
    dt.it_value.tv_sec = 0;
claus
parents: 345
diff changeset
  6982
    dt.it_value.tv_usec = 1000;   /* 1000 Hz */
claus
parents: 345
diff changeset
  6983
    setitimer(ITIMER_VIRTUAL, &dt, 0);
claus
parents: 345
diff changeset
  6984
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  6985
    RETURN (true);
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6986
#endif /* ITIMER_VIRTUAL */
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6987
%}.
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  6988
    ^ false
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6989
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6990
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6991
stopSpyTimer
359
claus
parents: 357
diff changeset
  6992
    "stop spy timing - disable spy timer.
claus
parents: 357
diff changeset
  6993
     OBSOLETE: the new messageTally runs as a high prio process, not using 
claus
parents: 357
diff changeset
  6994
	       spy interrupts."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6995
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6996
%{  /* NOCONTEXT */
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6997
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  6998
#if defined(ITIMER_VIRTUAL) && !defined(NO_SETITIMER)
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6999
    struct itimerval dt;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  7000
a27a279701f8 Initial revision
claus
parents:
diff changeset
  7001
    dt.it_interval.tv_sec = 0;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  7002
    dt.it_interval.tv_usec = 0;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  7003
    dt.it_value.tv_sec = 0;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  7004
    dt.it_value.tv_usec = 0;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  7005
    setitimer(ITIMER_VIRTUAL, &dt, 0);
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  7006
    RETURN (true);
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  7007
#endif /* ITIMER_VIRTUAL */
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  7008
%}.
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  7009
    ^ false
10
claus
parents: 5
diff changeset
  7010
!
claus
parents: 5
diff changeset
  7011
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  7012
terminateProcess:processId
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  7013
    "terminate a unix process.
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  7014
     The process has a chance to do some cleanup.
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  7015
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  7016
     WARNING: in order to avoid zombie processes (on unix),
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  7017
	      you may have to fetch the processes exitstatus with
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  7018
	      OperatingSystem>>getStatusOfProcess:aProcessId."
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  7019
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  7020
    self sendSignal:(self sigTERM) to:processId.
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  7021
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  7022
    "Modified: 28.12.1995 / 15:05:37 / stefan"
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  7023
!
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  7024
1280
b7ae6227f48b Allow setting of process group in exec:....
Stefan Vogel <sv@exept.de>
parents: 1247
diff changeset
  7025
terminateProcessGroup:processGroupId
b7ae6227f48b Allow setting of process group in exec:....
Stefan Vogel <sv@exept.de>
parents: 1247
diff changeset
  7026
    "terminate a unix process group.
b7ae6227f48b Allow setting of process group in exec:....
Stefan Vogel <sv@exept.de>
parents: 1247
diff changeset
  7027
     The process has a chance to do some cleanup.
b7ae6227f48b Allow setting of process group in exec:....
Stefan Vogel <sv@exept.de>
parents: 1247
diff changeset
  7028
b7ae6227f48b Allow setting of process group in exec:....
Stefan Vogel <sv@exept.de>
parents: 1247
diff changeset
  7029
     WARNING: in order to avoid zombie processes (on unix),
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  7030
	      you may have to fetch the processes exitstatus with
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  7031
	      OperatingSystem>>getStatusOfProcess:aProcessId."
1280
b7ae6227f48b Allow setting of process group in exec:....
Stefan Vogel <sv@exept.de>
parents: 1247
diff changeset
  7032
b7ae6227f48b Allow setting of process group in exec:....
Stefan Vogel <sv@exept.de>
parents: 1247
diff changeset
  7033
    self sendSignal:(self sigTERM) to:(processGroupId negated).
b7ae6227f48b Allow setting of process group in exec:....
Stefan Vogel <sv@exept.de>
parents: 1247
diff changeset
  7034
b7ae6227f48b Allow setting of process group in exec:....
Stefan Vogel <sv@exept.de>
parents: 1247
diff changeset
  7035
    "Modified: 28.12.1995 / 15:05:37 / stefan"
b7ae6227f48b Allow setting of process group in exec:....
Stefan Vogel <sv@exept.de>
parents: 1247
diff changeset
  7036
    "Created: 23.4.1996 / 16:40:34 / stefan"
b7ae6227f48b Allow setting of process group in exec:....
Stefan Vogel <sv@exept.de>
parents: 1247
diff changeset
  7037
!
b7ae6227f48b Allow setting of process group in exec:....
Stefan Vogel <sv@exept.de>
parents: 1247
diff changeset
  7038
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7039
unblockInterrupts
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7040
    "enable interrupt processing - if any interrupts are pending,
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7041
     these will be handled immediately.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7042
     When unblocking interrupts, take care of nested block/unblock
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7043
     calls - you must only unblock after a blockcall if they where
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7044
     really not blocked before. See OperatingSystemclass>>blockInterrupts."
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7045
%{
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7046
    __UNBLOCKINTERRUPTS();
1040
60e4c4bbbca2 return nil from unblockInterrupts (thats what the inlined code returns)
Claus Gittinger <cg@exept.de>
parents: 1034
diff changeset
  7047
    RETURN (nil);
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7048
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7049
! !
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7050
1799
0a2c5890f4f3 handle 'foo///' in directoryName
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  7051
!OperatingSystem class methodsFor:'misc'!
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7052
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7053
exit
710
10d86ca4c4a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 704
diff changeset
  7054
    "shutdown smalltalk immediately - this method does not return.
10d86ca4c4a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 704
diff changeset
  7055
     Return 'good'-status (0) to the parent unix process."
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7056
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7057
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7058
    __mainExit(0);
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7059
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7060
    "OperatingSystem exit - dont evaluate this"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7061
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7062
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7063
exit:exitCode
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7064
    "shutdown smalltalk immediately -
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7065
     returning an exit-code to the parent unix process."
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7066
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7067
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7068
    int code = 1;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7069
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7070
    if (__isSmallInteger(exitCode)) {
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  7071
	code = __intVal(exitCode);
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7072
    }
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7073
    __mainExit(code);
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7074
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7075
    "OperatingSystem exit:1 - dont evaluate this"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7076
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7077
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7078
exitWithCoreDump
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7079
    "shutdown smalltalk immediately - dumping core.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7080
     This always returns 'bad'-status to the parent unix process.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7081
     Notice, that no cleanup is performed at all - you may have to
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7082
     manually remove any tempfiles.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7083
     Use this only for debugging ST/X itself"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7084
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7085
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7086
    abort();
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7087
%}
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7088
    "
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7089
     OperatingSystem exitWithCoreDump - dont evaluate this
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7090
    "
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7091
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7092
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7093
slowFork:aBoolean
1247
2716d915e84e commentary
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  7094
    "set/clear the `avoid-fork-if-possible-because-its-slow' flag.
2716d915e84e commentary
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  7095
     Only used internally on SYSV3 systems"
2716d915e84e commentary
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  7096
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7097
    SlowFork := aBoolean
1247
2716d915e84e commentary
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  7098
2716d915e84e commentary
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  7099
    "Modified: 22.4.1996 / 13:13:09 / cg"
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7100
! !
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7101
1799
0a2c5890f4f3 handle 'foo///' in directoryName
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  7102
!OperatingSystem class methodsFor:'os queries'!
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7103
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  7104
executableFileExtensions
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  7105
    "return a collection of extensions for executable program files.
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  7106
     Only req'd for msdos like systems ..."
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  7107
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  7108
    self isMSDOSlike ifTrue:[
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  7109
	^ #('com' 'exe')
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  7110
    ].
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  7111
    ^ #('')
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  7112
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  7113
    "Created: 2.5.1997 / 11:42:29 / cg"
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  7114
!
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  7115
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7116
getCPUDefine
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7117
    "return a string which was used to identify this CPU type when STX was
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7118
     compiled, and which should be passed down when compiling methods.
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7119
     For example, on linux, this may be '-Di386'; on a vax, this would be '-Dvax'.
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7120
     This is normally not of interest to 'normal' users; however, it is passed
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7121
     down to the c-compiler when methods are incrementally compiled to machine code."
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7122
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7123
%{  /* NOCONTEXT */
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7124
#   ifndef CPU_DEFINE
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7125
#       define CPU_DEFINE "-DunknownCPU"
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7126
#   endif
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7127
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1675
diff changeset
  7128
    RETURN ( __MKSTRING(CPU_DEFINE));
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7129
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7130
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7131
     OperatingSystem getCPUDefine
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7132
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7133
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7134
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7135
getCPUType
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7136
    "return a string giving the type of machine we're running on.
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7137
     Here, the machine for which ST/X was compiled is returned
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7138
     (i.e. for all x86's, the same i386 is returned).
759
908363ce8a32 interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 756
diff changeset
  7139
     This may normally not be of any interest to you ..."
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7140
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7141
    |cpu|
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7142
    
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7143
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7144
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7145
#   ifdef vax
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7146
#    define CPU_STRING "vax"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7147
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7148
#   ifdef mips
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7149
#    define CPU_STRING "mips"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7150
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7151
#   ifdef i386
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7152
#    define CPU_STRING "i386"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7153
#   endif
2631
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  7154
#   ifdef i860
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  7155
#    define CPU_STRING "i860"
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  7156
#   endif
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7157
#   ifdef ns32k
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7158
#    define CPU_STRING "ns32k"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7159
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7160
#   ifdef mc68k
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7161
#    define CPU_STRING "mc68k"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7162
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7163
#   ifdef mc88k
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7164
#    define CPU_STRING "mc88k"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7165
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7166
#   ifdef sparc
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7167
#    define CPU_STRING "sparc"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7168
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7169
#   ifdef hppa
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7170
#    define CPU_STRING "hppa"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7171
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7172
#   ifdef rs6000
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7173
#    define CPU_STRING "rs6000"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7174
#   endif
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7175
#   ifdef powerPC
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7176
#    define CPU_STRING "powerPC"
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7177
#   endif
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7178
#   ifdef alpha
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7179
#    define CPU_STRING "alpha"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7180
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7181
#   ifdef transputer
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7182
#    define CPU_STRING "transputer"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7183
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7184
#   ifdef ibm370
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7185
#    define CPU_STRING "ibm370"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7186
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7187
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7188
#   ifndef CPU_STRING
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7189
#    define CPU_STRING "unknown"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7190
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7191
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1675
diff changeset
  7192
    cpu = __MKSTRING(CPU_STRING);
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7193
#   undef CPU_STRING
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7194
%}.
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7195
    ^ cpu
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7196
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7197
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7198
     OperatingSystem getCPUType
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7199
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7200
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7201
    "examples: are we running on a ss-10/solaris ?"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7202
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7203
     (OperatingSystem getCPUType = 'sparc') 
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7204
     and:[OperatingSystem getOSType = 'solaris']
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7205
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7206
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7207
    "or on a pc/solaris ?"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7208
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7209
     (OperatingSystem getCPUType = 'i386')
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7210
     and:[OperatingSystem getOSType = 'solaris']
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7211
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7212
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7213
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7214
getCommandOutputFrom:aCommand
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7215
    "execute a simple command (such as hostname) and
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7216
     return the commands output as a string"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7217
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7218
    |p result|
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7219
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7220
    ForkFailed ifFalse:[
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  7221
	PipeStream openErrorSignal handle:[:ex |
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  7222
	    ForkFailed := true.
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  7223
	    'OperatingSystem [warning]: cannot fork/popen' errorPrintCR.
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  7224
	    ex return.
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  7225
	] do:[
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  7226
	    p := PipeStream readingFrom:aCommand.
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  7227
	    p notNil ifTrue:[
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  7228
		result := p nextLine.
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  7229
		p close
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  7230
	    ]
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  7231
	]
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7232
    ].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7233
    ^ result
2131
1eeb310e109a newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
  7234
1eeb310e109a newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 2126
diff changeset
  7235
    "Modified: 10.1.1997 / 18:00:07 / cg"
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7236
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7237
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7238
getDomainName
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7239
    "return the domain this host is in.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7240
     Notice:
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  7241
	not all systems support this; on some, 'unknown' is returned."
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7242
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  7243
    |name idx hostName|
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7244
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7245
    DomainName notNil ifTrue:[
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  7246
	^ DomainName
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7247
    ].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7248
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7249
%{  /* STACK: 2048 */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7250
#if defined(HAS_GETDOMAINNAME)
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7251
    char buffer[128];
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7252
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7253
    if (getdomainname(buffer, sizeof(buffer)) == 0) {
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  7254
	name = __MKSTRING(buffer);
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7255
    }
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7256
#else
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7257
# if defined(HAS_UNAME) && defined(HAS_UTS_DOMAINNAME)
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7258
    struct utsname ubuff;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7259
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7260
    if (uname(&ubuff) >= 0) {
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  7261
	name = __MKSTRING(ubuff.domainname);
1433
8b2eacaea59c Getdomainname for Unixware.
Stefan Vogel <sv@exept.de>
parents: 1422
diff changeset
  7262
    }
8b2eacaea59c Getdomainname for Unixware.
Stefan Vogel <sv@exept.de>
parents: 1422
diff changeset
  7263
# else
8b2eacaea59c Getdomainname for Unixware.
Stefan Vogel <sv@exept.de>
parents: 1422
diff changeset
  7264
#  if defined(HAS_SYSINFO) && defined(SI_SRPC_DOMAIN)
8b2eacaea59c Getdomainname for Unixware.
Stefan Vogel <sv@exept.de>
parents: 1422
diff changeset
  7265
    char buffer[256];
8b2eacaea59c Getdomainname for Unixware.
Stefan Vogel <sv@exept.de>
parents: 1422
diff changeset
  7266
    int ret;
8b2eacaea59c Getdomainname for Unixware.
Stefan Vogel <sv@exept.de>
parents: 1422
diff changeset
  7267
8b2eacaea59c Getdomainname for Unixware.
Stefan Vogel <sv@exept.de>
parents: 1422
diff changeset
  7268
    if ((ret = sysinfo(SI_SRPC_DOMAIN, buffer, sizeof(buffer))) >= 0 && ret <= sizeof(buffer)) {
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  7269
	name = __MKSTRING(buffer);
1433
8b2eacaea59c Getdomainname for Unixware.
Stefan Vogel <sv@exept.de>
parents: 1422
diff changeset
  7270
    }
8b2eacaea59c Getdomainname for Unixware.
Stefan Vogel <sv@exept.de>
parents: 1422
diff changeset
  7271
#  endif
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7272
# endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7273
#endif
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  7274
#ifdef MSDOS_LIKE
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  7275
     {
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  7276
	char msdosBuf[128];
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  7277
     strcpy( msdosBuf, "exept.de" );
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  7278
	name = __MKSTRING(msdosBuf);
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  7279
     }
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  7280
#endif
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7281
%}.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7282
    name isNil ifTrue:[
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  7283
	name := self getEnvironment:'DOMAIN'.
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  7284
	name isNil ifTrue:[
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  7285
	    OperatingSystem isUNIXlike ifTrue:[
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  7286
		name := self getCommandOutputFrom:'domainname'
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  7287
	    ]
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  7288
	]
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7289
    ].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7290
    name isNil ifTrue:[
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  7291
	"/ sometimes, we can extract the domainName from the hostName ...
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  7292
	hostName := self getHostName.
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  7293
	hostName notNil ifTrue:[
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  7294
	    idx := hostName indexOf:$..
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  7295
	    idx ~~ 0 ifTrue:[
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  7296
		name := hostName copyFrom:idx+1.
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  7297
	    ]
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  7298
	]. 
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  7299
	name isNil ifTrue:[
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  7300
	    'OperatingSystem [warning]: cannot find out domainname' errorPrintCR.
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  7301
	    name := 'unknown'.
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  7302
	]
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7303
    ].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7304
    DomainName := name.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7305
    ^ name
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7306
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7307
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7308
     OperatingSystem getDomainName
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7309
    "
1433
8b2eacaea59c Getdomainname for Unixware.
Stefan Vogel <sv@exept.de>
parents: 1422
diff changeset
  7310
8b2eacaea59c Getdomainname for Unixware.
Stefan Vogel <sv@exept.de>
parents: 1422
diff changeset
  7311
    "Modified: 26.4.1996 / 10:04:54 / stefan"
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7312
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7313
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7314
getEnvironment:aStringOrSymbol
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7315
    "get an environment string"
10
claus
parents: 5
diff changeset
  7316
claus
parents: 5
diff changeset
  7317
%{  /* NOCONTEXT */
claus
parents: 5
diff changeset
  7318
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7319
    char *env;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7320
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7321
    if (__isString(aStringOrSymbol) || __isSymbol(aStringOrSymbol)) {
1632
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  7322
#ifdef WIN32
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  7323
	char buff[512];
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  7324
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  7325
	env = NULL;
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  7326
	if (GetEnvironmentVariable(__stringVal(aStringOrSymbol),
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  7327
				   buff,
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  7328
				   sizeof(buff)-1)) {
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  7329
	    env = buff;
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  7330
	}
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  7331
#else
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  7332
	env =  (char *)getenv(__stringVal(aStringOrSymbol));
1632
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  7333
#endif
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7334
	if (env) {
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1675
diff changeset
  7335
	    RETURN ( __MKSTRING(env) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7336
	}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7337
    }
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7338
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7339
.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7340
    ^ nil
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7341
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7342
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7343
     OperatingSystem getEnvironment:'LANG'
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7344
     OperatingSystem getEnvironment:'LOGIN'
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7345
     OperatingSystem getEnvironment:'HOME'
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7346
     OperatingSystem getEnvironment:'NNTPSERVER'
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7347
     OperatingSystem getEnvironment:'MAIL'
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7348
     OperatingSystem getEnvironment:'PATH'
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7349
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7350
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7351
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7352
getHostName
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7353
    "return the hostname we are running on - if there is
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7354
     a HOST environment variable, we are much faster here ...
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7355
     Notice:
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  7356
	not all systems support this; on some, 'unknown' is returned."
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7357
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  7358
    |name idx|
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7359
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7360
    HostName notNil ifTrue:[
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  7361
	^ HostName
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7362
    ].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7363
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7364
%{  /* STACK: 2048 */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7365
#if defined(HAS_GETHOSTNAME)
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  7366
    char buffer[256];
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7367
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7368
    if (gethostname(buffer, sizeof(buffer)) == 0) {
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  7369
	name = __MKSTRING(buffer);
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7370
    }
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7371
#else
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7372
# if defined(HAS_UNAME)
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7373
    struct utsname ubuff;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7374
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7375
    if (uname(&ubuff) >= 0) {
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  7376
	name = __MKSTRING(ubuff.nodename);
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7377
    }
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7378
# else
1702
777b74f65c7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  7379
#  if defined(HAS_SYSINFO) && defined(SI_HOSTNAME)
777b74f65c7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  7380
    char buffer[256];
777b74f65c7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  7381
    int ret;
777b74f65c7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  7382
 
777b74f65c7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  7383
    if ((ret = sysinfo(SI_HOSTNAME, buffer, sizeof(buffer))) >= 0 && ret <= sizeof(buffer)) {
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  7384
	name = __MKSTRING(buffer);
1702
777b74f65c7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  7385
    }
777b74f65c7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  7386
#  else
777b74f65c7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  7387
#   ifdef WIN32
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7388
    char buffer[128];
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7389
    int buffSize = sizeof(buffer);
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7390
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7391
    if (GetComputerName(buffer, &buffSize) == TRUE) {
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  7392
	name = __MKSTRING(buffer);
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7393
    }
1702
777b74f65c7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
  7394
#   endif
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7395
#  endif
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  7396
# endif
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7397
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7398
%}.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7399
    name isNil ifTrue:[
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  7400
	name := self getEnvironment:'HOST'.
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  7401
	name isNil ifTrue:[
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  7402
	    OperatingSystem isUNIXlike ifTrue:[
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  7403
		name := self getCommandOutputFrom:'hostname'
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  7404
	    ]
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  7405
	]
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7406
    ].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7407
    name isNil ifTrue:[
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  7408
	'OperatingSystem [warning]: cannot find out hostname' errorPrintCR.
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  7409
	name := 'unknown'.
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  7410
    ] ifFalse:[
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  7411
	"/ on some systems, the hostname already contains the domain.
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  7412
	"/ decompose it here.
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  7413
	idx := name indexOf:$..
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  7414
	idx ~~ 0 ifTrue:[
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  7415
	    DomainName := name copyFrom:(idx+1).
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  7416
	    name := name copyTo:(idx-1).
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  7417
	]
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7418
    ].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7419
    HostName := name.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7420
    ^ name
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7421
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7422
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7423
     OperatingSystem getHostName
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7424
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7425
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7426
1034
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7427
getLocaleInfo
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7428
    "return a dictionary filled with values from the locale information;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7429
     Not all fields may be present, depending on the OS's setup and capabilities.
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7430
     Possible fields are:
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7431
	decimalPoint                    <String>
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7432
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7433
	thousandsSep                    <String>
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7434
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7435
	internationalCurrencySymbol     <String>
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7436
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7437
	currencySymbol                  <String>
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7438
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7439
	monetaryDecimalPoint            <String>
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7440
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7441
	monetaryThousandsSeparator      <String>
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7442
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7443
	positiveSign                    <String>
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7444
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7445
	negativeSign                    <String>
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7446
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7447
	internationalFractionalDigits   <Integer>
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7448
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7449
	fractionalDigits                <Integer>
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7450
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7451
	positiveSignPrecedesCurrencySymbol      <Boolean>
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7452
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7453
	negativeSignPrecedesCurrencySymbol      <Boolean>
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7454
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7455
	positiveSignSeparatedBySpaceFromCurrencySymbol  <Boolean>
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7456
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7457
	negativeSignSeparatedBySpaceFromCurrencySymbol  <Boolean>
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7458
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7459
	positiveSignPosition                            <Symbol>
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7460
							one of: #parenthesesAround, 
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7461
								#signPrecedes, 
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7462
								#signSuceeds, 
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7463
								#signPrecedesCurrencySymbol,
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7464
								#signSuceedsCurrencySymbol
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7465
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7466
	negativeSignPosition                            <like above>
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7467
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7468
     it is up to the application to deal with undefined values.
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7469
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7470
     Notice, that (for now), the system does not use this information;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7471
     it should be used by applications as required.
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7472
    "
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7473
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7474
    |info val|
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7475
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7476
    LocaleInfo notNil ifTrue:[
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7477
	"/ return the internal info; useful on systems which do not
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7478
	"/ support this.
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7479
	^ LocaleInfo
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7480
    ].
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7481
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7482
    info := IdentityDictionary new.
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7483
%{
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7484
    char *decimalPoint;         /* something like "." (US) or "," (german) */
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7485
    char *thousandsSep;         /* something like "," (US) or "." (german) */
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7486
    char *intCurrencySymbol;    /* international currency symbol; something like "USD "  "DM  " */
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7487
    char *currencySymbol;       /* local currency symbol;         something like "USD "  "DM  " */
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7488
    char *monDecimalPoint;      /* money: decimal point */
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7489
    char *monThousandsSep;      /* money: thousands sep */
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7490
    char *positiveSign;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7491
    char *negativeSign;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7492
    int   intFractDigits;       /* money: international digits after decPoint */
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7493
    int   fractDigits;          /* money: local digits after decPoint */
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7494
    int   csPosPrecedes;        /* money: 1 if currency symbol precedes a positive value; 0 if it sceeds */
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7495
    int   csNegPrecedes;        /* money: 1 if currency symbol precedes a negative value; 0 if it sceeds */
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7496
    int   csPosSepBySpace;      /* money: 1 if currency symbol should be separated by a space from a positive value; 0 if no space */
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7497
    int   csNegSepBySpace;      /* money: 1 if currency symbol should be separated by a space from a negative value; 0 if no space */
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7498
    int   csPosSignPosition;    /* money: 0: ()'s around the value & currency symbol */
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7499
    int   csNegSignPosition;    /*        1: sign precedes the value & currency symbol */
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7500
				/*        2: sign succeeds the value & currency symbol */
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7501
				/*        3: sign immediately precedes the currency symbol */
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7502
				/*        4: sign immediately suceeds the currency symbol */
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7503
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7504
#if defined(HAS_LOCALECONV)
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7505
    struct lconv *conf;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7506
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7507
    conf = localeconv();
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7508
    if (conf) {
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7509
	decimalPoint = conf->decimal_point;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7510
	thousandsSep = conf->thousands_sep;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7511
	intCurrencySymbol = conf->int_curr_symbol;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7512
	currencySymbol = conf->currency_symbol;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7513
	monDecimalPoint = conf->mon_decimal_point;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7514
	monThousandsSep = conf->mon_thousands_sep;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7515
	positiveSign = conf->positive_sign;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7516
	negativeSign = conf->negative_sign;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7517
	intFractDigits = conf->int_frac_digits;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7518
	fractDigits = conf->frac_digits;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7519
	csPosPrecedes = conf->p_cs_precedes; 
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7520
	csNegPrecedes = conf->n_cs_precedes; 
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7521
	csPosSepBySpace = conf->p_sep_by_space; 
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7522
	csNegSepBySpace = conf->n_sep_by_space; 
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7523
	csPosSignPosition = conf->p_sign_posn;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7524
	csNegSignPosition = conf->n_sign_posn;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7525
    }
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7526
#else
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7527
    decimalPoint = (char *)0;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7528
    thousandsSep = (char *)0;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7529
    intCurrencySymbol = (char *)0;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7530
    currencySymbol = (char *)0;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7531
    monDecimalPoint = (char *)0;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7532
    monThousandsSep = (char *)0;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7533
    positiveSign =  (char *)0;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7534
    negativeSign =(char *)0;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7535
    intFractDigits = -1;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7536
    fractDigits = -1;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7537
    csPosPrecedes = -1; 
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7538
    csNegPrecedes = -1; 
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7539
    csPosSepBySpace = -1; 
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7540
    csNegSepBySpace = -1; 
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7541
    csPosSignPosition = -1;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7542
    csNegSignPosition = -1;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7543
#endif
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7544
    if (decimalPoint) {
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7545
	val = __MKSTRING(decimalPoint);
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7546
	__AT_PUT_(info, @symbol(decimalPoint), val);
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7547
    }
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7548
    if (thousandsSep) {
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7549
	val = __MKSTRING(thousandsSep);
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7550
	__AT_PUT_(info, @symbol(thousandsSeparator), val);
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7551
    }
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7552
    if (intCurrencySymbol) {
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7553
	val = __MKSTRING(intCurrencySymbol);
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7554
	__AT_PUT_(info, @symbol(internationCurrencySymbol), val);
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7555
    }
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7556
    if (currencySymbol) {
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7557
	val = __MKSTRING(currencySymbol);
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7558
	__AT_PUT_(info, @symbol(currencySymbol), val);
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7559
    }
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7560
    if (monDecimalPoint) {
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7561
	val = __MKSTRING(monDecimalPoint);
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7562
	__AT_PUT_(info, @symbol(monetaryDecimalPoint), val);
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7563
    }
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7564
    if (monThousandsSep) {
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7565
	val = __MKSTRING(monThousandsSep);
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7566
	__AT_PUT_(info, @symbol(monetaryThousandsSeparator), val);
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7567
    }
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7568
    if (positiveSign) {
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7569
	val = __MKSTRING(positiveSign);
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7570
	__AT_PUT_(info, @symbol(positiveSign), val);
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7571
    }
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7572
    if (negativeSign) {
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7573
	val = __MKSTRING(negativeSign);
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7574
	__AT_PUT_(info, @symbol(negativeSign), val);
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7575
    }
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7576
    if (intFractDigits >= 0) {
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7577
	__AT_PUT_(info, @symbol(internationalFractionalDigits),  __MKSMALLINT(intFractDigits));
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7578
    }
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7579
    if (fractDigits >= 0) {
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7580
	__AT_PUT_(info, @symbol(fractionalDigits),  __MKSMALLINT(fractDigits));
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7581
    }
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7582
    if (csPosPrecedes >= 0) {
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7583
	if (csPosPrecedes == 0) {
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7584
	    val = false;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7585
	} else {
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7586
	    val = true;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7587
	}
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7588
	__AT_PUT_(info, @symbol(positiveSignPrecedesCurrencySymbol), val );
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7589
    }
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7590
    if (csNegPrecedes >= 0) {
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7591
	if (csNegPrecedes == 0) {
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7592
	    val = false;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7593
	} else {
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7594
	    val = true;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7595
	}
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7596
	__AT_PUT_(info, @symbol(negativeSignPrecedesCurrencySymbol), val );
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7597
    }
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7598
    if (csPosSepBySpace >= 0) {
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7599
	if (csPosSepBySpace == 0) {
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7600
	    val = false;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7601
	} else {
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7602
	    val = true;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7603
	}
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7604
	__AT_PUT_(info, @symbol(positiveSignSeparatedBySpaceFromCurrencySymbol), val);
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7605
    }
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7606
    if (csNegSepBySpace >= 0) {
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7607
	if (csNegSepBySpace == 0) {
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7608
	    val = false;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7609
	} else {
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7610
	    val = true;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7611
	}
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7612
	__AT_PUT_(info, @symbol(negativeSignSeparatedBySpaceFromCurrencySymbol), val);
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7613
    }
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7614
    switch (csPosSignPosition) {
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7615
	case 0:
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7616
	    val = @symbol(parenthesesAround);
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7617
	    break;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7618
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7619
	case 1:
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7620
	    val = @symbol(signPrecedes);
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7621
	    break;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7622
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7623
	case 2:
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7624
	    val = @symbol(signSuceeds);
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7625
	    break;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7626
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7627
	case 3:
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7628
	    val = @symbol(signPrecedesCurrencySymbol);
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7629
	    break;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7630
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7631
	case 4:
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7632
	    val = @symbol(signSuceedsCurrencySymbol);
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7633
	    break;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7634
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7635
	default:
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7636
	    val = nil;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7637
    }
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7638
    if (val != nil) {
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7639
	__AT_PUT_(info, @symbol(positiveSignPosition), val);
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7640
    }
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7641
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7642
    switch (csNegSignPosition) {
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7643
	case 0:
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7644
	    val = @symbol(parenthesesAround);
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7645
	    break;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7646
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7647
	case 1:
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7648
	    val = @symbol(signPrecedes);
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7649
	    break;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7650
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7651
	case 2:
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7652
	    val = @symbol(signSuceeds);
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7653
	    break;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7654
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7655
	case 3:
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7656
	    val = @symbol(signPrecedesCurrencySymbol);
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7657
	    break;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7658
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7659
	case 4:
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7660
	    val = @symbol(signSuceedsCurrencySymbol);
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7661
	    break;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7662
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7663
	default:
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7664
	    val = nil;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7665
    }
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7666
    if (val != nil) {
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7667
	__AT_PUT_(info, @symbol(negativeSignPosition), val);
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7668
    }
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7669
%}.
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7670
    ^ info
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7671
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7672
    "
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7673
     OperatingSystem getLocaleInfo
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7674
    "
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7675
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7676
    "Created: 23.12.1995 / 14:19:20 / cg"
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7677
!
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  7678
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7679
getOSDefine
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7680
    "return a string which was used to identify this machine when stx was
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7681
     compiled, and which should be passed down when compiling methods.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7682
     For example, on linux, this is '-DLINUX'."
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7683
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7684
%{  /* NOCONTEXT */
2602
074f99294753 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2600
diff changeset
  7685
074f99294753 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2600
diff changeset
  7686
#ifndef OS_DEFINE
074f99294753 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2600
diff changeset
  7687
# ifdef WIN32
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7688
#  define OS_DEFINE "-DWIN32"
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7689
# endif
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  7690
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  7691
# ifndef OS_DEFINE
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  7692
#  define OS_DEFINE "-DunknownOS"
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  7693
# endif
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7694
#endif
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7695
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1675
diff changeset
  7696
    RETURN ( __MKSTRING(OS_DEFINE));
1987
8249e9134622 win32 changes
Claus Gittinger <cg@exept.de>
parents: 1982
diff changeset
  7697
8249e9134622 win32 changes
Claus Gittinger <cg@exept.de>
parents: 1982
diff changeset
  7698
#undef OS_DEFINE
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7699
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7700
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7701
     OperatingSystem getOSDefine
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7702
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7703
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7704
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7705
getOSType
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7706
    "return a string giving the type of OS we're running on.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7707
     This can be used to adapt programs to certain environment
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7708
     differences (for example: mail-lock strategy ...)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7709
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7710
    |os|
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7711
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7712
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7713
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7714
#   ifdef MSDOS
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7715
#    define OS_STRING "msdos"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7716
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7717
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7718
#   ifdef WIN32
1987
8249e9134622 win32 changes
Claus Gittinger <cg@exept.de>
parents: 1982
diff changeset
  7719
#    define OS_STRING "win32"
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7720
#   endif
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7721
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7722
#   ifdef MSWINDOWS
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7723
#    define OS_STRING "mswindows"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7724
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7725
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7726
#   ifdef VMS
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  7727
#    ifdef __openVMS__
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  7728
#     define OS_STRING "openVMS"
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  7729
#    else
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  7730
#     define OS_STRING "VMS"
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  7731
#    endif
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7732
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7733
2602
074f99294753 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2600
diff changeset
  7734
#   ifdef MVS /* ;-) */
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7735
#    define OS_STRING "mvs"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7736
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7737
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7738
#   ifdef OS2
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7739
#    define OS_STRING "os2"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7740
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7741
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7742
#   ifdef sinix
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7743
#    define OS_STRING "sinix"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7744
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7745
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7746
#   ifdef ultrix
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7747
#    define OS_STRING "ultrix"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7748
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7749
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7750
#   ifdef sco
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7751
#    define OS_STRING "sco"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7752
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7753
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7754
#   ifdef hpux
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7755
#    define OS_STRING "hpux"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7756
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7757
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7758
#   ifdef LINUX
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7759
#    define OS_STRING "linux"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7760
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7761
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7762
#   ifdef sunos
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7763
#    define OS_STRING "sunos"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7764
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7765
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7766
#   ifdef solaris
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7767
#    define OS_STRING "solaris"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7768
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7769
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7770
#   ifdef IRIS
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7771
#    define OS_STRING "irix"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7772
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7773
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7774
#   ifdef aix
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7775
#    define OS_STRING "aix"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7776
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7777
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7778
#   ifdef realIX
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7779
#    define OS_STRING "realIX"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7780
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7781
2780
371b1022e75a osf OS-ID
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  7782
#   ifdef __osf__
371b1022e75a osf OS-ID
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  7783
#    define OS_STRING "osf"
371b1022e75a osf OS-ID
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  7784
#   endif
371b1022e75a osf OS-ID
Claus Gittinger <cg@exept.de>
parents: 2778
diff changeset
  7785
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7786
    /*
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7787
     * no concrete info; become somewhat vague ...
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7788
     */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7789
#   ifndef OS_STRING
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7790
#    ifdef MACH
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7791
#     define OS_STRING "mach"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7792
#    endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7793
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7794
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7795
#   ifndef OS_STRING
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7796
#    ifdef BSD
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7797
#     define OS_STRING "bsd"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7798
#    endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7799
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7800
#    ifdef SYSV
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7801
#     ifdef SYSV3
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7802
#      define OS_STRING "sys5_3"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7803
#     else
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7804
#      ifdef SYSV4
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7805
#       define OS_STRING "sys5_4"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7806
#      else
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7807
#       define OS_STRING "sys5"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7808
#      endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7809
#     endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7810
#    endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7811
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7812
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7813
    /*
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7814
     * become very vague ...
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7815
     */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7816
#   ifndef OS_STRING
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7817
#    ifdef POSIX
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7818
#     define OS_STRING "posix"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7819
#    endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7820
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7821
#   ifndef OS_STRING
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7822
#    ifdef UNIX
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7823
#     define OS_STRING "unix"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7824
#    endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7825
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7826
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7827
#   ifndef OS_STRING
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7828
#    define OS_STRING "unknown"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7829
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7830
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1675
diff changeset
  7831
    os = __MKSTRING(OS_STRING);
1987
8249e9134622 win32 changes
Claus Gittinger <cg@exept.de>
parents: 1982
diff changeset
  7832
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7833
#   undef OS_STRING
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7834
%}.
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7835
    ^ os
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7836
2602
074f99294753 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2600
diff changeset
  7837
    "
074f99294753 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2600
diff changeset
  7838
     OperatingSystem getOSType
074f99294753 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2600
diff changeset
  7839
    "
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7840
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7841
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7842
getProcessId
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7843
    "return the (unix-)processId"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7844
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7845
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7846
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7847
    int pid = 0;
2959
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  7848
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7849
#ifdef UNIX_LIKE
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7850
    pid = getpid();
1632
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  7851
#else
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  7852
# ifdef WIN32
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  7853
    pid = GetCurrentProcessId() & 0x3FFFFFFF;
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  7854
# endif
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7855
#endif
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  7856
    RETURN ( __MKSMALLINT(pid) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7857
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7858
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7859
     OperatingSystem getProcessId
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7860
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7861
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7862
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7863
getSystemID
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7864
    "if supported by the OS, return the systemID;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7865
     a unique per machine identification.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7866
     WARNING:
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7867
	not all systems support this; on some, 'unknown' is returned."
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7868
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7869
%{  /* NO_CONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7870
#if defined(IRIX5) && !defined(HAS_GETHOSTID)
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7871
    char idBuffer[MAXSYSIDSIZE];
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7872
    int retVal;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7873
    OBJ arr;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7874
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7875
    if ((retVal = syssgi(SGI_SYSID, idBuffer)) == 0) {
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7876
	arr = __BYTEARRAY_UNINITIALIZED_NEW_INT(MAXSYSIDSIZE);
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7877
	bcopy(idBuffer, __ByteArrayInstPtr(arr)->ba_element, MAXSYSIDSIZE);
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7878
	RETURN (arr);
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7879
    }
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7880
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7881
#if defined(HAS_GETHOSTID)
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7882
    int runningId;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7883
    OBJ arr;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7884
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7885
    runningId = gethostid();
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7886
    arr = __BYTEARRAY_UNINITIALIZED_NEW_INT(4);
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7887
    *(int *)(__ByteArrayInstPtr(arr)->ba_element) = runningId;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7888
    RETURN (arr);
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7889
#endif
2871
e1acda461aa0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
  7890
#if defined(HAS_SYSINFO) && defined(SI_HW_SERIAL)
e1acda461aa0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
  7891
    {
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  7892
	char buffer[128];
2871
e1acda461aa0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
  7893
e1acda461aa0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
  7894
	buffer[0] = 0;
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  7895
	if (sysinfo(SI_HW_SERIAL, buffer, sizeof(buffer))) {
2871
e1acda461aa0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
  7896
	    buffer[127] = 0;
e1acda461aa0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
  7897
	    if (strlen(buffer) > 0) {
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  7898
		RETURN(__MKSTRING(buffer));
2871
e1acda461aa0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
  7899
	    }
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  7900
	}
2871
e1acda461aa0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
  7901
    }
e1acda461aa0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
  7902
#endif
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  7903
#ifdef __VMS__
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  7904
    {
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  7905
	int sid = 0;
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  7906
	int status;
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  7907
	char buffer[64];
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  7908
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  7909
	struct itm$list3 syilist[2] = {
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  7910
	  { sizeof(sid), SYI$_SID, &sid, (void *) 0 },
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  7911
	  { 0, 0, 0, 0}
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  7912
	};
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  7913
	status = SYS$GETSYIW(0, 0, 0, syilist, 0, 0, 0, 0);
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  7914
	if (status != SS$_NORMAL) {
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  7915
	    errno = EVMSERR;
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  7916
	    fprintf(stderr, "OperatingSystem [warning]: $GETSYI failure for SYI$_SID");
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  7917
	    RETURN( nil );
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  7918
	}
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  7919
	sprintf(buffer, "%x", sid);
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  7920
	RETURN(__MKSTRING(buffer));
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  7921
    }
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  7922
#endif
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7923
%}.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7924
    ^ 'unknown'
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7925
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7926
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7927
     OperatingSystem getSystemID
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7928
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7929
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7930
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7931
getSystemInfo
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7932
    "return info on the system weare running on.
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7933
     If the system supports the uname system call, that info is returned;
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7934
     otherwise, some simulated info is returned.
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7935
 
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7936
     WARNING:
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7937
       Do not depend on the amount and contents of the returned information, some
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7938
       systems may return more/less than others. Also, the contents depends on the
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7939
       OS, for example, linux returns 'ix86', while WIN32 returns 'x86'.
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7940
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7941
       This method is mainly provided to augment error reports with some system
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7942
       information. 
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7943
       (in case of system/version specific OS errors, conditional workarounds and patches
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  7944
	may be based upon this info).
2631
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  7945
       Your application should NOT depend upon this in any way.
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7946
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7947
     The returned info may (or may not) contain:
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  7948
	#system -> some operating system identification (irix, Linux, nt, win32s ...) 
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  7949
	#version -> OS version (some os version identification)
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  7950
	#release -> OS release (3.5, 1.2.1 ...)
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  7951
	#node   -> some host identification (hostname)
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  7952
	#domain  -> domain name (hosts domain)
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  7953
	#machine -> type of machine (i586, mips ...)
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7954
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7955
2631
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  7956
    |sys node rel ver mach dom mtyp brel info arch|
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7957
1060
119d45f975e1 increased getSystemInfos stack - just to make certain
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
  7958
%{  /* STACK: 4096 */
2631
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  7959
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7960
#if defined(HAS_UNAME)
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7961
    struct utsname ubuff;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7962
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7963
    if (uname(&ubuff) >= 0) {
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  7964
	sys  = __MKSTRING(ubuff.sysname);
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  7965
	node = __MKSTRING(ubuff.nodename);
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  7966
	rel  = __MKSTRING(ubuff.release);
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  7967
	ver  = __MKSTRING(ubuff.version);
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  7968
	mach = __MKSTRING(ubuff.machine);
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7969
# ifdef HAS_UTS_DOMAINNAME
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  7970
	dom  = __MKSTRING(ubuff.domainname);
1675
b4cd81adda85 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1666
diff changeset
  7971
# else
b4cd81adda85 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1666
diff changeset
  7972
#  if defined(HAS_GETDOMAINNAME)
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  7973
	{
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  7974
	    char buffer[128];
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  7975
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  7976
	    if (getdomainname(buffer, sizeof(buffer)) == 0) {
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  7977
		dom = __MKSTRING(buffer);
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  7978
	    }
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  7979
	}
1675
b4cd81adda85 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1666
diff changeset
  7980
#  endif
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7981
# endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  7982
    }
2631
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  7983
2634
8decbe608108 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2633
diff changeset
  7984
# if defined(HAS_SYSINFO) && defined(SI_ARCHITECTURE)
2632
195c5f4346a9 use systeminfo (solaris) if available
Claus Gittinger <cg@exept.de>
parents: 2631
diff changeset
  7985
    {
195c5f4346a9 use systeminfo (solaris) if available
Claus Gittinger <cg@exept.de>
parents: 2631
diff changeset
  7986
	char buffer[128];
195c5f4346a9 use systeminfo (solaris) if available
Claus Gittinger <cg@exept.de>
parents: 2631
diff changeset
  7987
2633
c301fadc468b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  7988
	if (sysinfo(SI_ARCHITECTURE, buffer, sizeof(buffer))) {
c301fadc468b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  7989
	    arch = __MKSTRING(buffer);
2632
195c5f4346a9 use systeminfo (solaris) if available
Claus Gittinger <cg@exept.de>
parents: 2631
diff changeset
  7990
	}
195c5f4346a9 use systeminfo (solaris) if available
Claus Gittinger <cg@exept.de>
parents: 2631
diff changeset
  7991
    }
195c5f4346a9 use systeminfo (solaris) if available
Claus Gittinger <cg@exept.de>
parents: 2631
diff changeset
  7992
# endif
195c5f4346a9 use systeminfo (solaris) if available
Claus Gittinger <cg@exept.de>
parents: 2631
diff changeset
  7993
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7994
#else /* no uname */
2631
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  7995
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7996
# ifdef WIN32 
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7997
    char vsnBuffer[32];
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7998
    char *s;
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  7999
    int winVer;
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8000
    DWORD vsn;
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8001
    SYSTEM_INFO sysInfo;
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8002
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8003
    vsn = GetVersion();
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8004
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8005
    if (HIWORD(vsn) & 0x8000) {
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  8006
	s = "win32s";
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8007
    } else {
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  8008
	s = "nt";
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8009
    }
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1675
diff changeset
  8010
    sys = __MKSTRING(s);
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8011
    winVer = LOWORD(vsn);
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8012
    sprintf(vsnBuffer, "%d.%d", LOBYTE(winVer), HIBYTE(winVer));
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1675
diff changeset
  8013
    rel = __MKSTRING(vsnBuffer);
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8014
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8015
    GetSystemInfo(&sysInfo);
2631
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8016
    switch (sysInfo.wProcessorArchitecture) {
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8017
#  ifdef PROCESSOR_ARCHITECTURE_INTEL
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8018
	case PROCESSOR_ARCHITECTURE_INTEL:
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8019
	    s = "intel";
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8020
	    break;
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8021
#  endif
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8022
#  ifdef PROCESSOR_ARCHITECTURE_MIPS
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8023
	case PROCESSOR_ARCHITECTURE_MIPS:
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8024
	    s = "mips";
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8025
	    break;
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8026
#  endif
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8027
#  ifdef PROCESSOR_ARCHITECTURE_ALPHA
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8028
	case PROCESSOR_ARCHITECTURE_ALPHA:
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8029
	    s = "alpha";
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8030
	    break;
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8031
#  endif
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8032
#  ifdef PROCESSOR_ARCHITECTURE_PPC
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8033
	case PROCESSOR_ARCHITECTURE_PPC:
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8034
	    s = "ppc";
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8035
	    break;
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8036
#  endif
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8037
	default:
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8038
	    s = "unknown";
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8039
	    break;
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8040
    }
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8041
    arch = __MKSTRING(s);
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8042
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8043
    switch (sysInfo.dwProcessorType) {
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8044
#  ifdef PROCESSOR_INTEL_386
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8045
	case PROCESSOR_INTEL_386:
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8046
	    s = "i386";
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8047
	    break;
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8048
#  endif
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8049
#  ifdef PROCESSOR_INTEL_486
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8050
	case PROCESSOR_INTEL_486:
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8051
	    s = "i486";
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8052
	    break;
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8053
#  endif
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8054
#  ifdef PROCESSOR_INTEL_PENTIUM
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8055
	case PROCESSOR_INTEL_PENTIUM:
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8056
	    s = "i586";
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8057
	    break;
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8058
#  endif
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8059
#  ifdef PROCESSOR_INTEL_860
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8060
	case PROCESSOR_INTEL_860:
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8061
	    s = "i860";
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8062
	    break;
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8063
#  endif
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8064
#  ifdef PROCESSOR_MIPS_R2000
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8065
	case PROCESSOR_MIPS_R2000:
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8066
	    s = "r2000";
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8067
	    break;
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8068
#  endif
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8069
#  ifdef PROCESSOR_MIPS_R3000
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8070
	case PROCESSOR_MIPS_R3000:
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8071
	    s = "r3000";
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8072
	    break;
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8073
#  endif
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8074
#  ifdef PROCESSOR_MIPS_R4000
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8075
	case PROCESSOR_MIPS_R4000:
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8076
	    s = "r4000";
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8077
	    break;
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8078
#  endif
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8079
#  ifdef PROCESSOR_ALPHA_21064
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8080
	case PROCESSOR_ALPHA_21064:
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8081
	    s = "alpha21064";
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8082
	    break;
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8083
#  endif
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8084
	default:
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  8085
	    sprintf(vsnBuffer, "%d", sysInfo.dwProcessorType);
2631
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8086
	    s = vsnBuffer;
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8087
	    break;
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8088
    }
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8089
    mach = __MKSTRING(s);
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8090
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  8091
# else
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  8092
#  ifdef __VMS__
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  8093
#  endif /* VMS */
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8094
# endif /* WIN32 */
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8095
#endif /* no uname */
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8096
%}.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8097
    sys isNil ifTrue:[
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  8098
	sys := self getSystemType.
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8099
    ].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8100
    node isNil ifTrue:[
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  8101
	node := self getHostName.
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8102
    ].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8103
    dom isNil ifTrue:[
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  8104
	dom := self getDomainName.
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8105
    ].
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8106
    mach isNil ifTrue:[
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  8107
	mach := self getCPUType.
2631
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8108
    ].
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8109
    arch isNil ifTrue:[
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8110
	arch := 'unknown'.
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8111
    ].
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8112
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8113
    info := IdentityDictionary new.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8114
    info at:#system put:sys.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8115
    info at:#node put:node.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8116
    rel notNil ifTrue:[info at:#release put:rel].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8117
    ver notNil ifTrue:[info at:#version put:ver].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8118
    mach notNil ifTrue:[info at:#machine put:mach].
2631
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  8119
    arch notNil ifTrue:[info at:#architecture put:arch].
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8120
    dom notNil ifTrue:[info at:#domain put:dom].
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8121
    info at:#osType put:(self getOSType).
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8122
    ^ info
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8123
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8124
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8125
     OperatingSystem getSystemInfo
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8126
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8127
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8128
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8129
getSystemType
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8130
    "return a string giving the type of system we're running on.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8131
     This is almost the same as getOSType, but the returned string
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8132
     is slightly different for some systems (i.e. iris vs. irix).
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8133
     Dont depend on this - use getOSType. I dont really see a point
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8134
     here ... 
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8135
     (except for slight differences between next/mach and other machs)"
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8136
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8137
    |sys|
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8138
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8139
%{
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8140
#   ifdef NEXT
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8141
#    define SYS_STRING "next"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8142
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8143
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8144
#   ifdef IRIS
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8145
#    define SYS_STRING "iris"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8146
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8147
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8148
#   ifdef WIN32 
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8149
#    define SYS_STRING  "win32"
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8150
#   endif
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8151
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8152
#   ifdef SYS_STRING
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1675
diff changeset
  8153
     sys = __MKSTRING(SYS_STRING);
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8154
#    undef SYS_STRING
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8155
#   endif
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  8156
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8157
%}.
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8158
    sys isNil ifTrue:[
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8159
	^ self getOSType
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8160
    ].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8161
    ^ sys
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8162
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8163
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8164
     OperatingSystem getSystemType
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8165
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8166
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8167
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8168
getWindowsDirectory
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8169
    "internal interface - only for Windows based systems.
2619
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  8170
     Return the windows directory 
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  8171
     (which - depending on the system - may be \WINNT, \WINDOWS or whatever)
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8172
     On non-windows systems, nil is returned."
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8173
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8174
%{
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8175
#ifdef WIN32
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8176
    char buffer[MAXPATHLEN];
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8177
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8178
    if (GetWindowsDirectory(buffer, MAXPATHLEN)) {
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  8179
	RETURN (__MKSTRING(buffer));
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8180
    }
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8181
#endif
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8182
%}.
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8183
    ^ nil
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8184
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8185
    "
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8186
     OperatingSystem getWindowsDirectory
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8187
    "
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8188
!
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8189
2619
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  8190
getWindowsSystemDirectory
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  8191
    "internal interface - only for Windows based systems.
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  8192
     Return the windows system directory 
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  8193
     (which - depending on the system - may be \WINNT\SYSTEM32, 
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  8194
      \WINDOWS\SYSTEM or whatever)
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  8195
     On non-windows systems, nil is returned."
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  8196
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  8197
%{
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  8198
#ifdef WIN32
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  8199
    char buffer[MAXPATHLEN];
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  8200
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  8201
    if (GetSystemDirectory(buffer, MAXPATHLEN)) {
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  8202
	RETURN (__MKSTRING(buffer));
2619
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  8203
    }
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  8204
#endif
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  8205
%}.
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  8206
    ^ nil
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  8207
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  8208
    "
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  8209
     OperatingSystem getWindowsSystemDirectory
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  8210
    "
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  8211
!
7bda34b453c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  8212
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8213
isBSDlike
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8214
    "return true, if the OS we're running on is a 'real' unix."
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8215
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8216
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8217
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8218
#if defined(BSD) || defined(MACH) || defined(SYSV4)
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8219
    RETURN ( true );
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  8220
#endif
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8221
%}.
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  8222
    ^ false
10
claus
parents: 5
diff changeset
  8223
!
claus
parents: 5
diff changeset
  8224
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8225
isMAClike
2959
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  8226
    "return true, if running on a macOS (but not on A/UX)"
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8227
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8228
%{  /* NOCONTEXT */
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8229
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8230
#if defined(MACOS)
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8231
    RETURN ( true );
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8232
#endif
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8233
%}.
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8234
    ^ false
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8235
!
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8236
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8237
isMSDOSlike
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8238
    "return true, if the OS we're running on is msdos like 
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8239
     (in contrast to unix-like).
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8240
     This returns true for any of msdos, win32s, win95,
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8241
     winNT and os/2."
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8242
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8243
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8244
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8245
#if defined(MSDOS_LIKE)
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8246
    RETURN ( true );
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8247
#endif
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8248
%}.
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8249
    ^ false
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8250
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8251
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8252
isMSWINDOWSlike
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8253
    "return true, if running on a MS-Windows like system.
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8254
     This returns true for any of win32s, win95 and winNT."
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8255
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8256
%{  /* NOCONTEXT */
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8257
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8258
#if defined(WIN32)
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8259
    RETURN ( true );
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8260
#endif
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8261
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8262
%}.
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8263
    ^ false
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8264
!
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8265
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8266
isOS2like
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8267
    "return true, if the OS we're running on is OS2 like.
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8268
     Only returns true for a plain OS/2 system."
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8269
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8270
%{  /* NOCONTEXT */
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8271
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8272
#if defined(OS2)
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8273
    RETURN (true);
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8274
#endif
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8275
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8276
%}.
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8277
    ^ false
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8278
!
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8279
1034
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8280
isUNIXlike
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8281
    "return true, if the OS we're running on is a unix like."
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8282
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8283
%{  /* NOCONTEXT */
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8284
2904
3a776398ff05 various VMS changes
Claus Gittinger <cg@exept.de>
parents: 2896
diff changeset
  8285
#if !defined(UNIX_LIKE) || defined(__VMS__)
1034
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8286
    RETURN ( false );
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8287
#endif
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8288
%}.
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8289
    ^ true
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8290
!
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8291
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  8292
isVMSlike
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  8293
    "return true, if the OS we're running in is VMS (or openVMS)."
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  8294
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  8295
%{  /* NOCONTEXT */
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  8296
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  8297
#if !defined(__VMS__) && !defined(__openVMS__)
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  8298
    RETURN (false);
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  8299
#endif
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  8300
%}.
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  8301
    ^ true
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  8302
!
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  8303
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8304
maxFileNameLength
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8305
    "return the max number of characters in a filename.
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8306
     CAVEAT:
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  8307
	 Actually, the following is somewhat wrong - some systems
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  8308
	 support different sizes, depending on the volume.
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  8309
	 We return a somewhat conservative number here.
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  8310
	 Another entry, to query for volume specific max
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  8311
	 will be added in the future."
10
claus
parents: 5
diff changeset
  8312
claus
parents: 5
diff changeset
  8313
%{  /* NOCONTEXT */
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8314
 
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8315
    /*
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8316
     * TODO: newer systems provide a query function for this ... use it
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8317
     */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8318
#   if defined(BSD) || defined(SYSV4) || defined(LONGFILENAMES)
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8319
     RETURN ( __MKSMALLINT(255) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8320
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8321
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8322
#   ifdef realIX
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8323
      RETURN ( __MKSMALLINT(127) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8324
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8325
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8326
#   ifdef SYSV
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8327
      RETURN ( __MKSMALLINT(14) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8328
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8329
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8330
#   ifdef MSDOS
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8331
     RETURN ( __MKSMALLINT(9) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8332
#   endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8333
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8334
#   ifdef WIN32
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8335
     /*
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8336
      * mhmh - depends on the filesystem type
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8337
      */
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8338
     RETURN ( __MKSMALLINT(9) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8339
#   endif
2959
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  8340
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  8341
#   ifdef __VMS__
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  8342
     RETURN ( __MKSMALLINT(38) );
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  8343
#   endif
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8344
%}.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8345
    "unix default"
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8346
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8347
    ^ 14
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8348
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8349
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8350
maxPathLength
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8351
    "return the max number of characters in a pathName."
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8352
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8353
%{  /* NOCONTEXT */
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8354
    RETURN ( __MKSMALLINT(MAXPATHLEN) );
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8355
%}
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8356
    "
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8357
     OperatingSystem maxPathLength   
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8358
    "
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8359
!
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8360
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8361
pathSeparator
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8362
    "return the character which separates items in the PATH variable"
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8363
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8364
    self isMSDOSlike ifTrue:[
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  8365
	^ $;
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8366
    ].
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8367
    ^ $:
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8368
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8369
    "Created: 2.5.1997 / 11:36:47 / cg"
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8370
!
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  8371
2710
557d1842afd5 added #platformName
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  8372
platformName
557d1842afd5 added #platformName
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  8373
    "return a string describing the OS platform very we're running on.
557d1842afd5 added #platformName
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  8374
     This returns #unix for all unix derivatives.
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  8375
     I.e. it is much less specific than getOSType or getSystemType."
2710
557d1842afd5 added #platformName
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  8376
557d1842afd5 added #platformName
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  8377
    |os|
557d1842afd5 added #platformName
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  8378
557d1842afd5 added #platformName
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  8379
    os := self getSystemType.
557d1842afd5 added #platformName
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  8380
    os = 'win32' ifTrue:[ ^ #win32].
557d1842afd5 added #platformName
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  8381
    os = 'os2' ifTrue:[ ^ #os2].
557d1842afd5 added #platformName
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  8382
    os = 'macos' ifTrue:[ ^ #mac].
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  8383
    os = 'VMS' ifTrue:[ ^ #vms].
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  8384
    os = 'openVMS' ifTrue:[ ^ #vms].
2710
557d1842afd5 added #platformName
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  8385
    ^ #unix
557d1842afd5 added #platformName
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  8386
557d1842afd5 added #platformName
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  8387
    "
557d1842afd5 added #platformName
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  8388
     OperatingSystem platformName
557d1842afd5 added #platformName
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  8389
    "
557d1842afd5 added #platformName
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  8390
557d1842afd5 added #platformName
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  8391
    "Modified: 20.6.1997 / 17:37:26 / cg"
557d1842afd5 added #platformName
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  8392
!
557d1842afd5 added #platformName
Claus Gittinger <cg@exept.de>
parents: 2686
diff changeset
  8393
1034
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8394
setLocaleInfo:anInfoDictionary
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8395
    "set the locale information; if set, this oerrides the OS's settings.
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8396
     (internal in ST/X only - the OS's settings remain unaffected)
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8397
     See description of fields in #getLocaleInfo.
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8398
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8399
     Notice, that (for now), the system does not use this information;
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8400
     it should be used by applications as required."
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8401
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8402
    LocaleInfo := anInfoDictionary
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8403
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8404
    "
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8405
     |d|
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8406
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8407
     d := IdentityDictionary new.
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8408
     d at:#decimalPoint                 put:'.'         .
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8409
     d at:#thousandsSeparator           put:','         .
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8410
     d at:#currencySymbol               put:'USD'       .
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8411
     d at:#monetaryDecimalPoint         put:'.'         .
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8412
     d at:#monetaryThousandsSeparator   put:'.'         .
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8413
     d at:#fractionalDigits             put:2           .
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8414
     d at:#positiveSign                 put:'+'         .
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8415
     d at:#negativeSign                 put:'-'         .
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8416
     d at:#positiveSignPrecedesCurrencySymbol put:true          .
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8417
     d at:#negativeSignPrecedesCurrencySymbol put:false         .
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8418
     OperatingSystem setLocaleInfo:d
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8419
    "
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8420
!
4d3ef5de3ec8 care to reenable interrupts
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  8421
2959
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  8422
supportsChildInterrupts
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  8423
    "return true, if the OS supports childProcess termination signalling
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  8424
     through interrupts (i.e. SIGCHILD)"
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  8425
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  8426
%{  /* NOCONTEXT */
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  8427
#if defined(SIGCHLD) || defined(SIGCLD) || defined(__VMS__)
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  8428
    RETURN (true);
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  8429
#endif
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  8430
%}.
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  8431
    ^ false
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  8432
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  8433
    "
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  8434
     OperatingSystem supportsChildInterrupts 
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  8435
    "
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  8436
!
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  8437
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8438
supportsIOInterrupts
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8439
    "return true, if the OS supports IO availability interrupts 
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8440
     (i.e. SIGPOLL/SIGIO).
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8441
2834
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  8442
     Currently, this mechanism does not work on all
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  8443
     systems ...
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  8444
    "
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8445
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8446
%{  /* NOCONTEXT */
2834
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  8447
2846
7d4cd045aec0 ioInterrupts do not work on irix
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  8448
  /* positive defines here
7d4cd045aec0 ioInterrupts do not work on irix
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  8449
   *  - irix5.2 does not work
7d4cd045aec0 ioInterrupts do not work on irix
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  8450
   */
7d4cd045aec0 ioInterrupts do not work on irix
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  8451
#if defined(LINUX)
7d4cd045aec0 ioInterrupts do not work on irix
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  8452
7d4cd045aec0 ioInterrupts do not work on irix
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  8453
# if defined(SIGIO) || defined(SIGPOLL)
7d4cd045aec0 ioInterrupts do not work on irix
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  8454
#  if defined(F_GETFL) && defined(F_SETFL) && defined(FASYNC)
7d4cd045aec0 ioInterrupts do not work on irix
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  8455
#   if defined(F_SETOWN) || defined(FIOSETOWN)
2837
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8456
2834
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  8457
    RETURN (true);
2837
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8458
2846
7d4cd045aec0 ioInterrupts do not work on irix
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  8459
#   endif
754
0dcc8af63497 Fix enableIoInterrupts for SYSV4.
Stefan Vogel <sv@exept.de>
parents: 714
diff changeset
  8460
#  endif
0dcc8af63497 Fix enableIoInterrupts for SYSV4.
Stefan Vogel <sv@exept.de>
parents: 714
diff changeset
  8461
# endif
2846
7d4cd045aec0 ioInterrupts do not work on irix
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  8462
7d4cd045aec0 ioInterrupts do not work on irix
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  8463
#endif /* machines where it works */
7d4cd045aec0 ioInterrupts do not work on irix
Claus Gittinger <cg@exept.de>
parents: 2838
diff changeset
  8464
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8465
%}.
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  8466
    ^ false
2834
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  8467
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  8468
    "
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  8469
     OperatingSystem supportsIOInterrupts 
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  8470
    "
123
98771547e5ce OSSignals now here
claus
parents: 101
diff changeset
  8471
!
98771547e5ce OSSignals now here
claus
parents: 101
diff changeset
  8472
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8473
supportsNonBlockingIO
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8474
    "return true, if the OS supports nonblocking IO."
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8475
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8476
%{  /* NOCONTEXT */
754
0dcc8af63497 Fix enableIoInterrupts for SYSV4.
Stefan Vogel <sv@exept.de>
parents: 714
diff changeset
  8477
#if defined(F_GETFL) && defined(F_SETFL) && defined(FNDELAY)
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8478
       RETURN (true);
754
0dcc8af63497 Fix enableIoInterrupts for SYSV4.
Stefan Vogel <sv@exept.de>
parents: 714
diff changeset
  8479
#endif
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8480
%}.
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8481
    ^ false
2834
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  8482
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  8483
    "
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  8484
     OperatingSystem supportsNonBlockingIO  
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  8485
    "
123
98771547e5ce OSSignals now here
claus
parents: 101
diff changeset
  8486
!
98771547e5ce OSSignals now here
claus
parents: 101
diff changeset
  8487
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8488
supportsSelect
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8489
    "return true, if the OS supports selecting on multiple
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8490
     filedescriptors via select."
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8491
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8492
%{  /* NOCONTEXT */
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8493
#if defined(WIN32)
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8494
    RETURN (false);
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8495
#endif
2904
3a776398ff05 various VMS changes
Claus Gittinger <cg@exept.de>
parents: 2896
diff changeset
  8496
#if defined(__VMS__)
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  8497
    RETURN (false);     /* for now ... */
2904
3a776398ff05 various VMS changes
Claus Gittinger <cg@exept.de>
parents: 2896
diff changeset
  8498
#endif
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8499
#if defined(sco)
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8500
    /*
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  8501
     * sco has a select, but its broken: always waiting 1 second
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8502
     */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8503
    RETURN(false);
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8504
#endif
2620
6fbb5b11586b mkdir no longer uses systemCommand
Claus Gittinger <cg@exept.de>
parents: 2619
diff changeset
  8505
%}.
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8506
    ^ true
2834
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  8507
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  8508
    "
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  8509
     OperatingSystem supportsSelect 
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  8510
    "
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  8511
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8512
! !
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8513
1799
0a2c5890f4f3 handle 'foo///' in directoryName
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  8514
!OperatingSystem class methodsFor:'shared memory access'!
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8515
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8516
shmAttach:id address:addr flags:flags
1247
2716d915e84e commentary
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  8517
    "low level entry to shmat()-system call.
2716d915e84e commentary
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  8518
     Not supported on all operatingSystems"
2716d915e84e commentary
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  8519
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8520
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8521
#ifdef WANT_SHM
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8522
    void *address, *shmaddr;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8523
    int shmflg, shmid;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8524
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8525
    if (__isSmallInteger(addr)
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8526
     && __bothSmallInteger(flags, id)) {
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  8527
	shmaddr = (void *) __intVal(addr);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  8528
	shmflg = __intVal(flags);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  8529
	shmid = __intVal(id);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  8530
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  8531
	address = shmat(shmid, shmaddr, shmflg);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  8532
	if (address != (void *)-1) {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  8533
	    RETURN (__MKEXTERNALBYTES(addr));
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  8534
	}
2832
3b9900929fb3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2797
diff changeset
  8535
	@global(OperatingSystem:LastErrorNumber) = __MKSMALLINT(errno);
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  8536
	RETURN (nil);
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8537
    }
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8538
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8539
%}.
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  8540
    ^ self primitiveFailed
1247
2716d915e84e commentary
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  8541
2716d915e84e commentary
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  8542
    "Modified: 22.4.1996 / 13:15:12 / cg"
370
claus
parents: 369
diff changeset
  8543
!
claus
parents: 369
diff changeset
  8544
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8545
shmDetach:addr
1247
2716d915e84e commentary
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  8546
    "low level entry to shmdt()-system call.
2716d915e84e commentary
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  8547
     Not supported on all operatingSystems"
2716d915e84e commentary
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  8548
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8549
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8550
#ifdef WANT_SHM
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8551
    void *shmaddr;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8552
    int rslt;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8553
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8554
    if (__isSmallInteger(addr)) {
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  8555
	shmaddr = (void *) __intVal(addr);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  8556
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  8557
	rslt = shmdt(shmaddr);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  8558
	if (rslt != -1) {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  8559
	    RETURN (true);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  8560
	}
2832
3b9900929fb3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2797
diff changeset
  8561
	@global(OperatingSystem:LastErrorNumber) = __MKSMALLINT(errno);
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  8562
	RETURN (false);
370
claus
parents: 369
diff changeset
  8563
    }
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8564
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8565
%}.
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  8566
    ^ self primitiveFailed
1247
2716d915e84e commentary
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  8567
2716d915e84e commentary
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  8568
    "Modified: 22.4.1996 / 13:15:03 / cg"
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8569
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8570
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8571
shmGet:key size:size flags:flags
1247
2716d915e84e commentary
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  8572
    "low level entry to shmget()-system call.
2716d915e84e commentary
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  8573
     This is not for public use and not supported with all operatingSystems.
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8574
     - use the provided wrapper class SharedExternalBytes instead."
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8575
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8576
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8577
#ifdef WANT_SHM
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8578
    if (__bothSmallInteger(key, size)
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8579
     && __isSmallInteger(flags)) {
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  8580
	int rslt;
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  8581
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  8582
	rslt = shmget(__intVal(key), __intVal(size), __intVal(flags));
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  8583
	if (rslt != -1) {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  8584
	    RETURN (__MKSMALLINT(rslt));
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  8585
	}
2832
3b9900929fb3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2797
diff changeset
  8586
	@global(OperatingSystem:LastErrorNumber) = __MKSMALLINT(errno);
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  8587
	RETURN (nil);
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8588
    }
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8589
#endif
370
claus
parents: 369
diff changeset
  8590
%}.
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  8591
    ^ self primitiveFailed
1247
2716d915e84e commentary
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  8592
2716d915e84e commentary
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  8593
    "Modified: 22.4.1996 / 13:14:46 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  8594
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  8595
1799
0a2c5890f4f3 handle 'foo///' in directoryName
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  8596
!OperatingSystem class methodsFor:'time and date'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  8597
1499
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8598
computeDatePartsOf:osTime for:aBlock
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8599
    "compute year, month and day from the OS time, osTime
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8600
     and evaluate the argument, a 3-arg block with these.
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8601
     Conversion is to localtime including any daylight saving adjustments."
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8602
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8603
    |year month day osSeconds|
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8604
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8605
    osSeconds := osTime // 1000.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  8606
%{
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  8607
    struct tm* tmPtr;
2797
971e74335490 alpha changes
Claus Gittinger <cg@exept.de>
parents: 2795
diff changeset
  8608
    INT t;
971e74335490 alpha changes
Claus Gittinger <cg@exept.de>
parents: 2795
diff changeset
  8609
    TIME_T tt;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  8610
1499
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8611
    t = __longIntVal(osSeconds);
2797
971e74335490 alpha changes
Claus Gittinger <cg@exept.de>
parents: 2795
diff changeset
  8612
    tt = (TIME_T)t;
971e74335490 alpha changes
Claus Gittinger <cg@exept.de>
parents: 2795
diff changeset
  8613
971e74335490 alpha changes
Claus Gittinger <cg@exept.de>
parents: 2795
diff changeset
  8614
    tmPtr = localtime(&tt);
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  8615
    year = __MKSMALLINT(tmPtr->tm_year + 1900);
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  8616
    month = __MKSMALLINT(tmPtr->tm_mon + 1);
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  8617
    day = __MKSMALLINT(tmPtr->tm_mday);
810
9b3676f51220 mhmh - even though ultrix defines daylight,
Claus Gittinger <cg@exept.de>
parents: 809
diff changeset
  8618
%}.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  8619
    aBlock value:year value:month value:day
1499
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8620
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8621
    "
1510
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8622
     OperatingSystem computeDatePartsOf:0 for:[:y :m :d |
1885
219c3437ad01 added executeCommand with i/o redirection
Claus Gittinger <cg@exept.de>
parents: 1863
diff changeset
  8623
	y printCR. m printCR. d printCR
1499
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8624
     ]
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8625
    "
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8626
!
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8627
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8628
computeOSTimeFromYear:y month:m day:d hour:h minute:min seconds:s millis:millis
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8629
    "return the OS-dependent time for the given time and day. 
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8630
     The arguments are assumed to be in localtime including
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8631
     any daylight saving adjustings."
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8632
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8633
    |osSeconds|
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8634
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8635
%{
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8636
    struct tm tm;
2797
971e74335490 alpha changes
Claus Gittinger <cg@exept.de>
parents: 2795
diff changeset
  8637
    TIME_T t;
1499
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8638
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8639
    if (__bothSmallInteger(y, m) 
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8640
     && __bothSmallInteger(d, h)
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8641
     && __bothSmallInteger(min, s)) {
1588
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  8642
	tm.tm_hour = __intVal(h);
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  8643
	tm.tm_min = __intVal(min);
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  8644
	tm.tm_sec = __intVal(s);
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  8645
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  8646
	tm.tm_year = __intVal(y) - 1900;
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  8647
	tm.tm_mon = __intVal(m) - 1;
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  8648
	tm.tm_mday = __intVal(d);
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  8649
	tm.tm_isdst = -1;
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  8650
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  8651
	t = mktime(&tm);
2797
971e74335490 alpha changes
Claus Gittinger <cg@exept.de>
parents: 2795
diff changeset
  8652
	osSeconds = __MKUINT((INT)t);
1499
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8653
    }
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8654
%}.
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8655
    osSeconds notNil ifTrue:[
1588
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  8656
	^ osSeconds * 1000 + millis
1499
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8657
    ].    
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8658
    ^ self primitiveFailed
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8659
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8660
    "
1510
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8661
     OperatingSystem computeOSTimeFromYear:1970 month:1 day:1 hour:0 minute:0 seconds:0 millis:0
1499
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8662
    "
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8663
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8664
!
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8665
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8666
computeTimeAndDateFrom:osTime
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8667
    "given an OS-dependent time in osTime, return an Array
1511
823fcfbbb741 weekDay/yearDay start with0 in tm_ struct, but
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  8668
     containing (full-) year, month, day, hour, minute and seconds,
1510
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8669
     offset to UTC, daylight savings time flag, milliseconds,
1511
823fcfbbb741 weekDay/yearDay start with0 in tm_ struct, but
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  8670
     dayInYear (1..) and dayInWeek (1..).
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8671
     Conversion is to localtime including any daylight saving adjustments."
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8672
1510
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8673
    |low hi year month day hours minutes seconds millis utcOffset 
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8674
     dst yDay wDay osSeconds ret|
1499
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8675
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8676
    millis := osTime \\ 1000.
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8677
    osSeconds := osTime // 1000.
63
1f0cdefb013f *** empty log message ***
claus
parents: 51
diff changeset
  8678
%{
1f0cdefb013f *** empty log message ***
claus
parents: 51
diff changeset
  8679
    struct tm *tmPtr;
810
9b3676f51220 mhmh - even though ultrix defines daylight,
Claus Gittinger <cg@exept.de>
parents: 809
diff changeset
  8680
    struct tm *gmTmPtr;
2797
971e74335490 alpha changes
Claus Gittinger <cg@exept.de>
parents: 2795
diff changeset
  8681
    INT t;
971e74335490 alpha changes
Claus Gittinger <cg@exept.de>
parents: 2795
diff changeset
  8682
    TIME_T tt;
63
1f0cdefb013f *** empty log message ***
claus
parents: 51
diff changeset
  8683
1499
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8684
    t = __longIntVal(osSeconds);
2797
971e74335490 alpha changes
Claus Gittinger <cg@exept.de>
parents: 2795
diff changeset
  8685
    tt = (TIME_T)t;
971e74335490 alpha changes
Claus Gittinger <cg@exept.de>
parents: 2795
diff changeset
  8686
971e74335490 alpha changes
Claus Gittinger <cg@exept.de>
parents: 2795
diff changeset
  8687
    tmPtr = localtime(&tt);
1499
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8688
    hours = __MKSMALLINT(tmPtr->tm_hour);
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8689
    minutes = __MKSMALLINT(tmPtr->tm_min);
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8690
    seconds = __MKSMALLINT(tmPtr->tm_sec);
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8691
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8692
    year = __MKSMALLINT(tmPtr->tm_year + 1900);
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8693
    month = __MKSMALLINT(tmPtr->tm_mon + 1);
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8694
    day = __MKSMALLINT(tmPtr->tm_mday);
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8695
1511
823fcfbbb741 weekDay/yearDay start with0 in tm_ struct, but
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  8696
    yDay = __MKSMALLINT(tmPtr->tm_yday+1);
1512
d4e6376dce78 weekDay fix (sunday is 0 in tm_wday)
Claus Gittinger <cg@exept.de>
parents: 1511
diff changeset
  8697
    wDay = __MKSMALLINT(tmPtr->tm_wday == 0 ? 7 : tmPtr->tm_wday);
1510
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8698
1499
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8699
    if (tmPtr->tm_isdst == 0) {
1588
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  8700
	dst = false;
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  8701
	utcOffset = __MKINT(TIMEZONE(tmPtr));
1499
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8702
    } else {
1588
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  8703
	dst = true;
800
067094efdaed use HAS_ALTZONE / HAS_DAYLIGHT
Claus Gittinger <cg@exept.de>
parents: 798
diff changeset
  8704
#ifdef HAS_ALTZONE
2643
a2d0b7f38be6 oops - _MKINT() + 3600 is wrong (parenth)
Claus Gittinger <cg@exept.de>
parents: 2642
diff changeset
  8705
	utcOffset = __MKINT(altzone);
800
067094efdaed use HAS_ALTZONE / HAS_DAYLIGHT
Claus Gittinger <cg@exept.de>
parents: 798
diff changeset
  8706
#else
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  8707
	utcOffset = __MKINT(TIMEZONE(tmPtr) + 3600);
1499
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8708
#endif
63
1f0cdefb013f *** empty log message ***
claus
parents: 51
diff changeset
  8709
    }
241
6f30be88e314 *** empty log message ***
claus
parents: 234
diff changeset
  8710
%}.
1499
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8711
    "I would love to have SELF-like inline objects ..."
1510
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8712
    ret := Array new:11.
1499
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8713
    ret at:1 put:year.
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8714
    ret at:2 put:month.
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8715
    ret at:3 put:day.
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8716
    ret at:4 put:hours.
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8717
    ret at:5 put:minutes.
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8718
    ret at:6 put:seconds.
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8719
    ret at:7 put:utcOffset.
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8720
    ret at:8 put:dst.
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8721
    ret at:9 put:millis.
1510
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8722
    ret at:10 put:yDay.
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8723
    ret at:11 put:wDay.
1499
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8724
    ^ ret
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8725
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8726
    "
1510
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8727
     OperatingSystem computeTimeAndDateFrom:0
1499
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8728
    "
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8729
!
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8730
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8731
computeTimePartsOf:osTime for:aBlock
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8732
    "compute hours, minutes, seconds and milliseconds from the osTime 
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8733
     and evaluate the argument, a 4-arg block with these.
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8734
     Conversion is to localtime including any daylight saving adjustments."
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8735
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8736
    |hours minutes seconds millis osSeconds|
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8737
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8738
    osSeconds := osTime // 1000.
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8739
    millis := osTime \\ 1000.
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8740
%{
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8741
    struct tm *tmPtr;
2797
971e74335490 alpha changes
Claus Gittinger <cg@exept.de>
parents: 2795
diff changeset
  8742
    INT t;
971e74335490 alpha changes
Claus Gittinger <cg@exept.de>
parents: 2795
diff changeset
  8743
    TIME_T tt;
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8744
1499
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8745
    t = __longIntVal(osSeconds);
2797
971e74335490 alpha changes
Claus Gittinger <cg@exept.de>
parents: 2795
diff changeset
  8746
    tt = (TIME_T)t;
971e74335490 alpha changes
Claus Gittinger <cg@exept.de>
parents: 2795
diff changeset
  8747
971e74335490 alpha changes
Claus Gittinger <cg@exept.de>
parents: 2795
diff changeset
  8748
    tmPtr = localtime(&tt);
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  8749
    hours = __MKSMALLINT(tmPtr->tm_hour);
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  8750
    minutes = __MKSMALLINT(tmPtr->tm_min);
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  8751
    seconds = __MKSMALLINT(tmPtr->tm_sec);
810
9b3676f51220 mhmh - even though ultrix defines daylight,
Claus Gittinger <cg@exept.de>
parents: 809
diff changeset
  8752
%}.
1499
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8753
    aBlock value:hours value:minutes value:seconds value:millis
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8754
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8755
    "
1510
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8756
     OperatingSystem computeTimePartsOf:100 for:[:h :m :s :milli |
1588
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  8757
	h printCR. m printCR. s printCR. millis printCR
1499
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8758
     ]
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8759
    "
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8760
!
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8761
1510
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8762
computeUTCTimeAndDateFrom:osTime
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8763
    "given an OS-dependent time in osTime, return an Array
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8764
     containing year, month, day, hour, minute and seconds,
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8765
     offset to UTC, daylight savings time flag, milliseconds,
1511
823fcfbbb741 weekDay/yearDay start with0 in tm_ struct, but
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  8766
     dayInYear (1..) and dayInWeek (1..).
1510
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8767
     Conversion is to UTC."
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8768
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8769
    |low hi year month day hours minutes seconds millis utcOffset 
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8770
     dst yDay wDay osSeconds ret|
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8771
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8772
    millis := osTime \\ 1000.
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8773
    osSeconds := osTime // 1000.
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8774
%{
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8775
    struct tm *tmPtr;
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8776
    struct tm *gmTmPtr;
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8777
    long t;
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8778
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8779
    t = __longIntVal(osSeconds);
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8780
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8781
    tmPtr = gmtime(&t);
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8782
    hours = __MKSMALLINT(tmPtr->tm_hour);
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8783
    minutes = __MKSMALLINT(tmPtr->tm_min);
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8784
    seconds = __MKSMALLINT(tmPtr->tm_sec);
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8785
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8786
    year = __MKSMALLINT(tmPtr->tm_year + 1900);
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8787
    month = __MKSMALLINT(tmPtr->tm_mon + 1);
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8788
    day = __MKSMALLINT(tmPtr->tm_mday);
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8789
1511
823fcfbbb741 weekDay/yearDay start with0 in tm_ struct, but
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  8790
    yDay = __MKSMALLINT(tmPtr->tm_yday + 1);
1512
d4e6376dce78 weekDay fix (sunday is 0 in tm_wday)
Claus Gittinger <cg@exept.de>
parents: 1511
diff changeset
  8791
    wDay = __MKSMALLINT(tmPtr->tm_wday == 0 ? 7 : tmPtr->tm_wday);
1510
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8792
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8793
    if (tmPtr->tm_isdst == 0) {
1588
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  8794
	dst = false;
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  8795
	utcOffset = __MKINT(TIMEZONE(tmPtr));
1510
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8796
    } else {
1588
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  8797
	dst = true;
1510
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8798
#ifdef HAS_ALTZONE
2643
a2d0b7f38be6 oops - _MKINT() + 3600 is wrong (parenth)
Claus Gittinger <cg@exept.de>
parents: 2642
diff changeset
  8799
	utcOffset = __MKINT(altzone);
1510
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8800
#else
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  8801
	utcOffset = __MKINT(TIMEZONE(tmPtr) + 3600);
1510
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8802
#endif
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8803
    }
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8804
%}.
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8805
    "I would love to have SELF-like inline objects ..."
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8806
    ret := Array new:11.
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8807
    ret at:1 put:year.
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8808
    ret at:2 put:month.
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8809
    ret at:3 put:day.
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8810
    ret at:4 put:hours.
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8811
    ret at:5 put:minutes.
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8812
    ret at:6 put:seconds.
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8813
    ret at:7 put:utcOffset.
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8814
    ret at:8 put:dst.
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8815
    ret at:9 put:millis.
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8816
    ret at:10 put:yDay.
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8817
    ret at:11 put:wDay.
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8818
    ^ ret
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8819
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8820
    "
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8821
     OperatingSystem computeUTCTimeAndDateFrom:0
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8822
    "
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8823
!
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8824
1499
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8825
computeUTCTimePartsOf:osTime for:aBlock
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8826
    "compute hours, minutes, seconds and milliseconds from the osTime 
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8827
     and evaluate the argument, a 4-arg block with these.
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8828
     Conversion is to UTC."
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8829
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8830
    |hours minutes seconds millis osSeconds|
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8831
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8832
    osSeconds := osTime // 1000.
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8833
    millis := osTime \\ 1000.
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8834
%{
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8835
    struct tm *tmPtr;
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8836
    long t;
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8837
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8838
    t = __longIntVal(osSeconds);
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8839
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8840
    tmPtr = gmtime(&t);
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8841
    hours = __MKSMALLINT(tmPtr->tm_hour);
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8842
    minutes = __MKSMALLINT(tmPtr->tm_min);
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8843
    seconds = __MKSMALLINT(tmPtr->tm_sec);
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8844
%}.
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8845
    aBlock value:hours value:minutes value:seconds value:millis
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8846
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8847
    "
1510
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  8848
     OperatingSystem computeUTCTimePartsOf:100 for:[:h :m :s :milli |
1588
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  8849
	h printCR. m printCR. s printCR. milli printCR
1499
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8850
     ]
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8851
    "
275
a76029ddaa98 *** empty log message ***
claus
parents: 252
diff changeset
  8852
!
a76029ddaa98 *** empty log message ***
claus
parents: 252
diff changeset
  8853
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  8854
getMillisecondTime
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  8855
    "This returns the millisecond timers value. 
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  8856
     The range is limited to 0..1fffffff (i.e. the SmallInteger range) to avoid
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  8857
     LargeInteger arithmetic when doing timeouts and delays.
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  8858
     Since this value is wrapping around in regular intervals, this can only be used for 
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  8859
     short relative time deltas.
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  8860
     Use the millisecondTimeXXX:-methods to compare and add time deltas - these know about the wrap.
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  8861
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  8862
     BAD DESIGN:
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  8863
	This should be changed to return some instance of RelativeTime,
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  8864
	and these computations moved there.
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  8865
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  8866
     Dont use this method in application code since it is an internal (private)
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  8867
     interface. For compatibility with ST-80, use Time millisecondClockValue.
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  8868
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  8869
a27a279701f8 Initial revision
claus
parents:
diff changeset
  8870
%{  /* NOCONTEXT */
a27a279701f8 Initial revision
claus
parents:
diff changeset
  8871
2834
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  8872
    long t = 0;
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  8873
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  8874
#if !defined(HAS_GETTIMEOFDAY)
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  8875
# if defined(HAS_FTIME)
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  8876
    struct timeb timebuffer;
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  8877
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  8878
    ftime(&timebuffer);
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  8879
    t = (timebuffer.time * 1000) + timebuffer.millitm;
2837
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8880
#   define HAVE_TIME
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8881
# endif
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8882
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8883
# ifndef HAVE_TIME
2834
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  8884
#  if defined(SYSV) && defined(HZ)
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  8885
    /* 
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  8886
     * sys5 time
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  8887
     */
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  8888
    long ticks;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  8889
    struct tms tb;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  8890
a27a279701f8 Initial revision
claus
parents:
diff changeset
  8891
    ticks = times(&tb);
a27a279701f8 Initial revision
claus
parents:
diff changeset
  8892
    t = (ticks * 1000) / HZ;
2837
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8893
#   define HAVE_TIME
2834
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  8894
#  endif /* old SYSV stuff */
0a63eb45de45 ioInterrupts work (must set fd's owner)
Claus Gittinger <cg@exept.de>
parents: 2832
diff changeset
  8895
# endif
2837
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8896
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8897
# ifndef HAVE_TIME
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8898
#  ifdef WIN32
1632
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  8899
    t = GetTickCount();
2837
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8900
#   define HAVE_TIME
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8901
#  endif
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8902
# endif
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8903
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8904
# ifndef HAVE_TIME
1632
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  8905
#  ifdef MSDOS_LIKE
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  8906
    struct _timeb timebuffer;
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  8907
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  8908
    _ftime(&timebuffer);
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  8909
    t = (timebuffer.time * 1000) + timebuffer.millitm;
2837
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8910
#   define HAVE_TIME
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8911
#  endif
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8912
# endif
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8913
#endif
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8914
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8915
#ifndef HAVE_TIME
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8916
    /* assume HAS_GETTIMEOFDAY 
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8917
     * - will result in a linkage error
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8918
     * if not fixed.
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8919
     */
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8920
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  8921
    /*
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  8922
     * bsd time
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  8923
     */
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  8924
    struct timeval tb;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  8925
    struct timezone tzb;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  8926
a27a279701f8 Initial revision
claus
parents:
diff changeset
  8927
    gettimeofday(&tb, &tzb);
a27a279701f8 Initial revision
claus
parents:
diff changeset
  8928
    t = tb.tv_sec*1000 + tb.tv_usec/1000;
2837
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8929
#endif
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8930
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8931
#undef HAVE_TIME
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8932
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  8933
    RETURN ( __MKSMALLINT(t & 0x1FFFFFFF) );
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  8934
%}
a27a279701f8 Initial revision
claus
parents:
diff changeset
  8935
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  8936
1499
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8937
getOSTime
2949
6993ad758a9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
  8938
    "This returns the OS time.
2000
2c12eb609e05 commentary
Claus Gittinger <cg@exept.de>
parents: 1991
diff changeset
  8939
     The base of the returned value is not consistent across
2c12eb609e05 commentary
Claus Gittinger <cg@exept.de>
parents: 1991
diff changeset
  8940
     different OS's - some return the number of millis since jan, 1st 1970;
2c12eb609e05 commentary
Claus Gittinger <cg@exept.de>
parents: 1991
diff changeset
  8941
     others since 1900. The Time classes are prepared for this, and 
2949
6993ad758a9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
  8942
     converts as appropriate (by using my fromOSTime: conversion methods).
1499
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8943
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8944
     Dont use this method in application code since it is an internal (private)
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8945
     interface. For compatibility with ST-80, use Time>>millisecondClockValue.
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8946
     or use instances of Time, Date or AbsoluteTime to work with.
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8947
    "
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8948
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8949
    |seconds millis|
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8950
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8951
%{
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8952
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8953
    long t;
2837
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8954
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8955
#if !defined(HAS_GETTIMEOFDAY) 
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8956
# if defined(HAS_FTIME)
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8957
    struct timeb timebuffer;
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8958
2949
6993ad758a9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
  8959
    ftime(&timebuffer);
2837
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8960
    seconds = __MKUINT(timebuffer.time);
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8961
    millis = __MKUINT(timebuffer.millitm);
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8962
#   define HAVE_TIME
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8963
# endif
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8964
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8965
# ifndef HAVE_TIME
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8966
#  if defined(SYSV) && defined(HZ)
1499
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8967
    /* 
2000
2c12eb609e05 commentary
Claus Gittinger <cg@exept.de>
parents: 1991
diff changeset
  8968
     * sys5 time; we have to fake the information
2c12eb609e05 commentary
Claus Gittinger <cg@exept.de>
parents: 1991
diff changeset
  8969
     * the returned value is inexact.
1499
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8970
     */
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  8971
    int now;
1499
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8972
    long ticks;
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8973
    struct tms tb;
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8974
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8975
    now = time(0);   /* seconds since 1970 ... */
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8976
    seconds = __MKUINT(now);
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8977
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8978
    ticks = times(&tb);
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8979
    t = (ticks * 1000) / HZ;
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8980
    t = t % 1000;
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8981
    millis = __MKSMALLINT(t);
2837
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8982
#  endif /* OLD SYSV stuff */
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8983
# endif
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8984
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8985
# ifndef HAVE_TIME
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8986
#  ifdef MSDOS_LIKE
1499
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8987
    struct _timeb timebuffer;
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8988
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8989
    _ftime(&timebuffer);
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  8990
    seconds = __MKUINT(timebuffer.time);
2635
769fefb49ea8 care for gigaByte-sized files ...
Claus Gittinger <cg@exept.de>
parents: 2634
diff changeset
  8991
    millis = __MKUINT(timebuffer.millitm);
2837
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8992
#   define HAVE_TIME
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8993
#  endif
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8994
# endif
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8995
#endif
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8996
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8997
#ifndef HAVE_TIME
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8998
    /* assume HAS_GETTIMEOFDAY 
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  8999
     * - will result in a linkage error
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  9000
     * if not fixed.
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  9001
     */
1499
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  9002
    /*
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  9003
     * bsd time
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  9004
     */
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  9005
    struct timeval tb;
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  9006
    struct timezone tzb;
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  9007
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  9008
    gettimeofday(&tb, &tzb);
2487
8130679ad53b use long-long arithmetic to compute the osTime
Claus Gittinger <cg@exept.de>
parents: 2281
diff changeset
  9009
8130679ad53b use long-long arithmetic to compute the osTime
Claus Gittinger <cg@exept.de>
parents: 2281
diff changeset
  9010
    /* 
8130679ad53b use long-long arithmetic to compute the osTime
Claus Gittinger <cg@exept.de>
parents: 2281
diff changeset
  9011
     * mhmh long-long stuff seems not to work correctly 
8130679ad53b use long-long arithmetic to compute the osTime
Claus Gittinger <cg@exept.de>
parents: 2281
diff changeset
  9012
     * on all machines (sparc)
2488
7d0beb26dbd2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2487
diff changeset
  9013
     * being conservative here ...
2487
8130679ad53b use long-long arithmetic to compute the osTime
Claus Gittinger <cg@exept.de>
parents: 2281
diff changeset
  9014
     */
8130679ad53b use long-long arithmetic to compute the osTime
Claus Gittinger <cg@exept.de>
parents: 2281
diff changeset
  9015
2837
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  9016
# if defined(__GNUC__) && (__GNUC__ >= 2) && defined(i386) && defined(LINUX)
2487
8130679ad53b use long-long arithmetic to compute the osTime
Claus Gittinger <cg@exept.de>
parents: 2281
diff changeset
  9017
#   define HAS_LONGLONG
2837
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  9018
# endif
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  9019
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  9020
# ifdef HAS_LONGLONG
2487
8130679ad53b use long-long arithmetic to compute the osTime
Claus Gittinger <cg@exept.de>
parents: 2281
diff changeset
  9021
    {
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  9022
	unsigned long long _secs, _millis, rslt;
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  9023
	unsigned low, hi;
2621
Claus Gittinger <cg@exept.de>
parents: 2620
diff changeset
  9024
	OBJ __MKLARGEINT64();
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  9025
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  9026
	_secs = tb.tv_sec;
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  9027
	_millis = tb.tv_usec / 1000;
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  9028
	rslt = _secs * 1000 + _millis;
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  9029
	low = rslt & 0xFFFFFFFF;
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  9030
	hi = rslt >> 32;
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  9031
	RETURN (__MKLARGEINT64(1, low, hi));
2487
8130679ad53b use long-long arithmetic to compute the osTime
Claus Gittinger <cg@exept.de>
parents: 2281
diff changeset
  9032
    }
2837
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  9033
# endif /* long long */
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  9034
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  9035
# ifdef alpha64
2784
14e8085b8eea alpha64 change
Claus Gittinger <cg@exept.de>
parents: 2780
diff changeset
  9036
    {
14e8085b8eea alpha64 change
Claus Gittinger <cg@exept.de>
parents: 2780
diff changeset
  9037
	unsigned INT _secs, _millis, rslt;
14e8085b8eea alpha64 change
Claus Gittinger <cg@exept.de>
parents: 2780
diff changeset
  9038
14e8085b8eea alpha64 change
Claus Gittinger <cg@exept.de>
parents: 2780
diff changeset
  9039
	_secs = (INT) tb.tv_sec;
14e8085b8eea alpha64 change
Claus Gittinger <cg@exept.de>
parents: 2780
diff changeset
  9040
	_millis = (INT) tb.tv_usec / 1000;
14e8085b8eea alpha64 change
Claus Gittinger <cg@exept.de>
parents: 2780
diff changeset
  9041
	rslt = _secs * 1000 + _millis;
14e8085b8eea alpha64 change
Claus Gittinger <cg@exept.de>
parents: 2780
diff changeset
  9042
	RETURN (__MKUINT(rslt));
14e8085b8eea alpha64 change
Claus Gittinger <cg@exept.de>
parents: 2780
diff changeset
  9043
    }
2837
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  9044
# endif /* alpha */
2784
14e8085b8eea alpha64 change
Claus Gittinger <cg@exept.de>
parents: 2780
diff changeset
  9045
1499
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  9046
    seconds = __MKUINT(tb.tv_sec);
2635
769fefb49ea8 care for gigaByte-sized files ...
Claus Gittinger <cg@exept.de>
parents: 2634
diff changeset
  9047
    millis = __MKUINT(tb.tv_usec / 1000);
1499
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  9048
2837
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  9049
#endif
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  9050
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  9051
#undef HAVE_TIME
a1be15166392 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2834
diff changeset
  9052
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9053
%}.
1499
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  9054
    ^ (seconds * 1000) + millis
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  9055
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  9056
    "
1510
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  9057
     OperatingSystem getOSTime printCR.
1499
0df07e1d0c2f osTime is now a largeInteger, which includes the milliseconds.
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  9058
     Delay waitForSeconds:0.2.
1510
d7987cc00dc4 added interface for UTC timeAndDate handling;
Claus Gittinger <cg@exept.de>
parents: 1499
diff changeset
  9059
     OperatingSystem getOSTime printCR.
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9060
    "
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9061
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9062
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9063
maximumMillisecondTimeDelta
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9064
    "this returns the maximum delta supported by millisecondCounter
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9065
     based methods. The returned value is half the value at which the
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9066
     timer wraps."
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9067
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9068
%{  /* NOCONTEXT */
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  9069
    RETURN ( __MKSMALLINT(0x0FFFFFFF) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9070
%}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9071
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9072
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9073
millisecondDelay:millis
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9074
    "delay execution for millis milliseconds or until the next event
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9075
     arrives.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9076
     All lower priority threads will also sleep for the duration, 
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9077
     interrupts (and therefore, higher prio processes) are
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9078
     still handled. 
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9079
     Better use a Delay, to only delay the calling thread.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9080
     (however, a delay cannot be used in the event handler or scheduler)"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9081
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9082
    |now then delta|
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9083
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9084
%{  /* NOCONTEXT */
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9085
#ifdef WIN32
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9086
    int t = __intVal(millis);
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9087
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9088
    if (t) {
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  9089
	Sleep(t);
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9090
    }
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9091
    RETURN (self);
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9092
#endif
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9093
#ifdef __openVMS__
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9094
# ifdef HAS_USLEEP
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9095
    int millis = __intVal(millis);
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9096
    int micros;
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9097
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9098
    while (millis >= 1000) {
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9099
	sleep(1);
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9100
	if (InterruptPending != nil) {
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9101
	    break;
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9102
	}
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9103
	millis -= 1000;
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9104
    }
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9105
    micros = millis * 1000;
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9106
    if (InterruptPending == nil) {
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  9107
	usleep(micros);
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9108
    }
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9109
    RETURN(self);
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9110
# endif
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9111
#endif
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9112
%}.
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9113
 
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9114
    now := OperatingSystem getMillisecondTime.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9115
    then := OperatingSystem millisecondTimeAdd:now and:millis.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9116
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9117
    [OperatingSystem millisecondTime:then isAfter:now] whileTrue:[
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9118
	delta := OperatingSystem millisecondTimeDeltaBetween:then and:now.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9119
	self selectOnAnyReadable:nil writable:nil exception:nil withTimeOut:delta.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9120
	now := OperatingSystem getMillisecondTime.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9121
    ]
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9122
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9123
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9124
     OperatingSystem millisecondDelay:2000
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9125
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9126
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9127
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9128
millisecondTime:msTime1 isAfter:msTime2
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9129
    "return true if msTime1 is after msTime2, false if not.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9130
     The two arguments are supposed to be millisecond times 
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9131
     (such as returned getMillisecondTime) which wrap at 16r1FFFFFFF.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9132
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9133
     This should really be moved to some RelativeTime class."
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9134
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9135
    (msTime1 > msTime2) ifTrue:[
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9136
	((msTime1 - msTime2) >= 16r10000000) ifTrue:[
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9137
	    ^ false
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9138
	].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9139
	^ true
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9140
    ].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9141
    ((msTime2 - msTime1) > 16r10000000) ifTrue:[
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9142
	^ true
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9143
    ].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9144
    ^ false
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9145
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9146
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9147
millisecondTimeAdd:msTime1 and:msTime2
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9148
    "Add two millisecond times (such as returned getMillisecondTime).
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9149
     The returned value is msTime1 + msTime2 where a wrap occurs at:16r1FFFFFFF.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9150
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9151
     This should really be moved to some RelativeTime class."
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9152
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9153
    |sum|
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9154
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9155
    sum := msTime1 + msTime2.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9156
    (sum > 16r1FFFFFFF) ifTrue:[^ sum - 16r20000000].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9157
    (sum < 0) ifTrue:[^ sum + 16r20000000].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9158
    ^ sum
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9159
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9160
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  9161
millisecondTimeDeltaBetween:msTime1 and:msTime2
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9162
    "subtract two millisecond times (such as returned getMillisecondTime)
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  9163
     and return the difference. Since milli-times wrap (at 16r01FFFFFFF), 
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9164
     some special handling is built-in here.
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  9165
     The returned value is msTime1 - msTime2. The returned value is invalid
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  9166
     if the delta is >= 0x10000000.
63
1f0cdefb013f *** empty log message ***
claus
parents: 51
diff changeset
  9167
810
9b3676f51220 mhmh - even though ultrix defines daylight,
Claus Gittinger <cg@exept.de>
parents: 809
diff changeset
  9168
     This should really be moved to some RelativeTime class;
9b3676f51220 mhmh - even though ultrix defines daylight,
Claus Gittinger <cg@exept.de>
parents: 809
diff changeset
  9169
     better yet: create a subclass of Integer named LimitedRangeInteger."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  9170
a27a279701f8 Initial revision
claus
parents:
diff changeset
  9171
    (msTime1 > msTime2) ifTrue:[
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  9172
	^ msTime1 - msTime2
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  9173
    ].
a27a279701f8 Initial revision
claus
parents:
diff changeset
  9174
    ^ msTime1 + 16r10000000 - msTime2
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9175
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9176
    "
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9177
     OperatingSystem millisecondTimeAdd:16r0FFFFFFF and:1   
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9178
     OperatingSystem millisecondTimeAdd:16r0FFFFFFF and:(16 / 3)  
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9179
     OperatingSystem millisecondTimeAdd:16r0FFFFFFF and:1000   
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9180
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9181
     OperatingSystem millisecondTimeDeltaBetween:0 and:16r0FFFFFFF  
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9182
     OperatingSystem millisecondTimeDeltaBetween:(13/3) and:16r0FFFFFFF     
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9183
     OperatingSystem millisecondTimeDeltaBetween:999 and:16r0FFFFFFF       
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9184
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9185
     OperatingSystem millisecondTime:0 isAfter:16r0FFFFFFF    
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9186
     OperatingSystem millisecondTime:(13/3) isAfter:16r0FFFFFFF   
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9187
     OperatingSystem millisecondTime:999 isAfter:16r0FFFFFFF       
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9188
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9189
     OperatingSystem millisecondTime:0 isAfter:0          
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9190
     OperatingSystem millisecondTime:(13/3) isAfter:0  
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9191
     OperatingSystem millisecondTime:999 isAfter:0       
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9192
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9193
     OperatingSystem millisecondTime:1 isAfter:0        
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9194
     OperatingSystem millisecondTime:(13/3) isAfter:2
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9195
     OperatingSystem millisecondTime:999 isAfter:900       
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9196
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9197
     |t1 t2|
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9198
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9199
     t1 := Time millisecondClockValue.
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9200
     (Delay forMilliseconds:1) wait.   
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9201
     t2 := Time millisecondClockValue.
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9202
     OperatingSystem millisecondTimeDeltaBetween:t2 and:t1 
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9203
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  9204
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  9205
a27a279701f8 Initial revision
claus
parents:
diff changeset
  9206
sleep:numberOfSeconds
1845
9d7e909b61dd some methods are compiled for space
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
  9207
    "{ Pragma: +optSpace }"
9d7e909b61dd some methods are compiled for space
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
  9208
308
f04744ef7b5d *** empty log message ***
claus
parents: 300
diff changeset
  9209
    "cease ANY action for some time. This suspends the whole smalltalk
f04744ef7b5d *** empty log message ***
claus
parents: 300
diff changeset
  9210
     (unix-) process for some time.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  9211
     Not really useful since not even low-prio processes and interrupt
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9212
     handling will run during the sleep.
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9213
     Use either OperatingSystem>>millisecondDelay: (which makes all
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9214
     threads sleep, but handles interrupts) or use a Delay (which makes
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9215
     only the calling thread sleep)."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  9216
a27a279701f8 Initial revision
claus
parents:
diff changeset
  9217
%{  /* NOCONTEXT */
a27a279701f8 Initial revision
claus
parents:
diff changeset
  9218
252
  9219
    if (__isSmallInteger(numberOfSeconds)) {
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  9220
	sleep(__intVal(numberOfSeconds));
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  9221
	RETURN ( self );
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  9222
    }
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  9223
%}.
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  9224
    "
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  9225
     argument not integer
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  9226
    "
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
  9227
    ^ self primitiveFailed
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9228
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9229
    "
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9230
     OperatingSystem sleep:2
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9231
    "
10
claus
parents: 5
diff changeset
  9232
! !
claus
parents: 5
diff changeset
  9233
1799
0a2c5890f4f3 handle 'foo///' in directoryName
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  9234
!OperatingSystem class methodsFor:'users & groups'!
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9235
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9236
getEffectiveGroupID
1845
9d7e909b61dd some methods are compiled for space
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
  9237
    "{ Pragma: +optSpace }"
9d7e909b61dd some methods are compiled for space
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
  9238
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9239
    "return the current users (thats you) effective numeric group id.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9240
     This is only different from getGroupID, if you have ST/X running
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9241
     as a setuid program (of which you should think about twice)."
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9242
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9243
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9244
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9245
#ifdef UNIX_LIKE
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9246
    int uid;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9247
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9248
    uid = getegid();
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9249
    RETURN ( __MKSMALLINT(uid) );
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9250
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9251
    /* --- return same as getGroupID --- */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9252
%}.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9253
    ^ self getGroupID
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9254
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9255
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9256
     OperatingSystem getEffectiveGroupID
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9257
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9258
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9259
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9260
getEffectiveUserID
1845
9d7e909b61dd some methods are compiled for space
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
  9261
    "{ Pragma: +optSpace }"
9d7e909b61dd some methods are compiled for space
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
  9262
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9263
    "return the current users (thats you) effective numeric user id.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9264
     This is only different from getUserID, if you have ST/X running
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9265
     as a setuid program (of which you should think about twice)."
10
claus
parents: 5
diff changeset
  9266
claus
parents: 5
diff changeset
  9267
%{  /* NOCONTEXT */
claus
parents: 5
diff changeset
  9268
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9269
#ifdef UNIX_LIKE
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9270
    int uid;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9271
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9272
    uid = geteuid();
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9273
    RETURN ( __MKSMALLINT(uid) );
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9274
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9275
    /* --- return same as getUserID --- */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9276
%}.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9277
    ^ self getUserID
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9278
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9279
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9280
     OperatingSystem getEffectiveUserID
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9281
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9282
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9283
2251
40f3765a94ff added #getFullUserName (a shortcut)
Claus Gittinger <cg@exept.de>
parents: 2156
diff changeset
  9284
getFullUserName
40f3765a94ff added #getFullUserName (a shortcut)
Claus Gittinger <cg@exept.de>
parents: 2156
diff changeset
  9285
    "{ Pragma: +optSpace }"
40f3765a94ff added #getFullUserName (a shortcut)
Claus Gittinger <cg@exept.de>
parents: 2156
diff changeset
  9286
2252
ece20502eaf2 comments
Claus Gittinger <cg@exept.de>
parents: 2251
diff changeset
  9287
    "return a string with the users full name (thats you) - if available.
2251
40f3765a94ff added #getFullUserName (a shortcut)
Claus Gittinger <cg@exept.de>
parents: 2156
diff changeset
  9288
     If not, return the login name as a fallBack."
40f3765a94ff added #getFullUserName (a shortcut)
Claus Gittinger <cg@exept.de>
parents: 2156
diff changeset
  9289
40f3765a94ff added #getFullUserName (a shortcut)
Claus Gittinger <cg@exept.de>
parents: 2156
diff changeset
  9290
    ^ self
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  9291
	getFullUserNameFromID:(self getUserID)
2251
40f3765a94ff added #getFullUserName (a shortcut)
Claus Gittinger <cg@exept.de>
parents: 2156
diff changeset
  9292
40f3765a94ff added #getFullUserName (a shortcut)
Claus Gittinger <cg@exept.de>
parents: 2156
diff changeset
  9293
    "
40f3765a94ff added #getFullUserName (a shortcut)
Claus Gittinger <cg@exept.de>
parents: 2156
diff changeset
  9294
     OperatingSystem getFullUserName 
40f3765a94ff added #getFullUserName (a shortcut)
Claus Gittinger <cg@exept.de>
parents: 2156
diff changeset
  9295
    "
40f3765a94ff added #getFullUserName (a shortcut)
Claus Gittinger <cg@exept.de>
parents: 2156
diff changeset
  9296
2252
ece20502eaf2 comments
Claus Gittinger <cg@exept.de>
parents: 2251
diff changeset
  9297
    "Modified: 24.1.1997 / 11:31:55 / cg"
2251
40f3765a94ff added #getFullUserName (a shortcut)
Claus Gittinger <cg@exept.de>
parents: 2156
diff changeset
  9298
!
40f3765a94ff added #getFullUserName (a shortcut)
Claus Gittinger <cg@exept.de>
parents: 2156
diff changeset
  9299
1549
df9d235c992e added #getFullUserNameFromID:, to access the GECOS field
Claus Gittinger <cg@exept.de>
parents: 1512
diff changeset
  9300
getFullUserNameFromID:userID
1845
9d7e909b61dd some methods are compiled for space
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
  9301
    "{ Pragma: +optSpace }"
9d7e909b61dd some methods are compiled for space
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
  9302
1549
df9d235c992e added #getFullUserNameFromID:, to access the GECOS field
Claus Gittinger <cg@exept.de>
parents: 1512
diff changeset
  9303
    "return a string with the users full name - if available.
df9d235c992e added #getFullUserNameFromID:, to access the GECOS field
Claus Gittinger <cg@exept.de>
parents: 1512
diff changeset
  9304
     If not, return the login name as a fallBack."
df9d235c992e added #getFullUserNameFromID:, to access the GECOS field
Claus Gittinger <cg@exept.de>
parents: 1512
diff changeset
  9305
df9d235c992e added #getFullUserNameFromID:, to access the GECOS field
Claus Gittinger <cg@exept.de>
parents: 1512
diff changeset
  9306
    |info gecos|
df9d235c992e added #getFullUserNameFromID:, to access the GECOS field
Claus Gittinger <cg@exept.de>
parents: 1512
diff changeset
  9307
df9d235c992e added #getFullUserNameFromID:, to access the GECOS field
Claus Gittinger <cg@exept.de>
parents: 1512
diff changeset
  9308
    info := self userInfoOf:userID.
df9d235c992e added #getFullUserNameFromID:, to access the GECOS field
Claus Gittinger <cg@exept.de>
parents: 1512
diff changeset
  9309
    (info notNil
df9d235c992e added #getFullUserNameFromID:, to access the GECOS field
Claus Gittinger <cg@exept.de>
parents: 1512
diff changeset
  9310
    and:[info includesKey:#gecos]) ifTrue:[
1588
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  9311
	gecos := info at:#gecos.
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  9312
	(gecos includes:$,) ifTrue:[
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  9313
	    ^ gecos copyTo:(gecos indexOf:$,) - 1
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  9314
	].
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  9315
	^ gecos
1549
df9d235c992e added #getFullUserNameFromID:, to access the GECOS field
Claus Gittinger <cg@exept.de>
parents: 1512
diff changeset
  9316
    ].
df9d235c992e added #getFullUserNameFromID:, to access the GECOS field
Claus Gittinger <cg@exept.de>
parents: 1512
diff changeset
  9317
    ^ self getUserNameFromID:userID
df9d235c992e added #getFullUserNameFromID:, to access the GECOS field
Claus Gittinger <cg@exept.de>
parents: 1512
diff changeset
  9318
df9d235c992e added #getFullUserNameFromID:, to access the GECOS field
Claus Gittinger <cg@exept.de>
parents: 1512
diff changeset
  9319
    "
df9d235c992e added #getFullUserNameFromID:, to access the GECOS field
Claus Gittinger <cg@exept.de>
parents: 1512
diff changeset
  9320
     OperatingSystem getFullUserNameFromID:0 
df9d235c992e added #getFullUserNameFromID:, to access the GECOS field
Claus Gittinger <cg@exept.de>
parents: 1512
diff changeset
  9321
     OperatingSystem getFullUserNameFromID:(OperatingSystem getUserID)  
df9d235c992e added #getFullUserNameFromID:, to access the GECOS field
Claus Gittinger <cg@exept.de>
parents: 1512
diff changeset
  9322
df9d235c992e added #getFullUserNameFromID:, to access the GECOS field
Claus Gittinger <cg@exept.de>
parents: 1512
diff changeset
  9323
     OperatingSystem getUserNameFromID:(OperatingSystem getUserID)  
df9d235c992e added #getFullUserNameFromID:, to access the GECOS field
Claus Gittinger <cg@exept.de>
parents: 1512
diff changeset
  9324
    "
df9d235c992e added #getFullUserNameFromID:, to access the GECOS field
Claus Gittinger <cg@exept.de>
parents: 1512
diff changeset
  9325
df9d235c992e added #getFullUserNameFromID:, to access the GECOS field
Claus Gittinger <cg@exept.de>
parents: 1512
diff changeset
  9326
    "Modified: 15.7.1996 / 12:44:21 / cg"
df9d235c992e added #getFullUserNameFromID:, to access the GECOS field
Claus Gittinger <cg@exept.de>
parents: 1512
diff changeset
  9327
!
df9d235c992e added #getFullUserNameFromID:, to access the GECOS field
Claus Gittinger <cg@exept.de>
parents: 1512
diff changeset
  9328
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9329
getGroupID
1845
9d7e909b61dd some methods are compiled for space
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
  9330
    "{ Pragma: +optSpace }"
9d7e909b61dd some methods are compiled for space
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
  9331
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9332
    "return the current users (thats you) numeric group id"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9333
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9334
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9335
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9336
#ifdef UNIX_LIKE
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9337
    int uid;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9338
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9339
    uid = getgid();
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9340
    RETURN ( __MKSMALLINT(uid) );
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9341
#else
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9342
# ifdef SYSTEM_HAS_GROUPS
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9343
    /* ... */
10
claus
parents: 5
diff changeset
  9344
# endif
claus
parents: 5
diff changeset
  9345
#endif
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  9346
%}.
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9347
    ^ 1 "just a dummy for systems which do not have userIDs"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9348
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  9349
    "
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9350
     OperatingSystem getGroupID
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9351
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9352
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9353
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9354
getGroupNameFromID:aNumber
1845
9d7e909b61dd some methods are compiled for space
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
  9355
    "{ Pragma: +optSpace }"
9d7e909b61dd some methods are compiled for space
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
  9356
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9357
    "return the group-name-string for a given numeric group-id"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9358
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9359
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9360
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9361
#ifdef UNIX_LIKE
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  9362
# ifndef __openVMS__
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9363
    struct group *g;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9364
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9365
    if (__isSmallInteger(aNumber)) {
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  9366
	g = getgrgid(__intVal(aNumber));
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9367
	if (g) {
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1675
diff changeset
  9368
	    RETURN ( __MKSTRING(g->gr_name) );
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9369
	}
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9370
    }
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  9371
# endif /* not openVMS */
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  9372
#endif /* unix-like */
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9373
%}.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9374
    ^ '???'
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9375
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9376
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9377
     OperatingSystem getGroupNameFromID:0
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9378
     OperatingSystem getGroupNameFromID:10
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9379
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9380
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9381
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9382
getHomeDirectory
1845
9d7e909b61dd some methods are compiled for space
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
  9383
    "{ Pragma: +optSpace }"
9d7e909b61dd some methods are compiled for space
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
  9384
2252
ece20502eaf2 comments
Claus Gittinger <cg@exept.de>
parents: 2251
diff changeset
  9385
    "return the name of the users home directory
ece20502eaf2 comments
Claus Gittinger <cg@exept.de>
parents: 2251
diff changeset
  9386
     (i.e. yours)"
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9387
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9388
    ^ OperatingSystem getEnvironment:'HOME'
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9389
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9390
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9391
     OperatingSystem getHomeDirectory
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9392
    "
2252
ece20502eaf2 comments
Claus Gittinger <cg@exept.de>
parents: 2251
diff changeset
  9393
ece20502eaf2 comments
Claus Gittinger <cg@exept.de>
parents: 2251
diff changeset
  9394
    "Modified: 24.1.1997 / 11:32:13 / cg"
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9395
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9396
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9397
getLoginName
1845
9d7e909b61dd some methods are compiled for space
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
  9398
    "{ Pragma: +optSpace }"
9d7e909b61dd some methods are compiled for space
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
  9399
2252
ece20502eaf2 comments
Claus Gittinger <cg@exept.de>
parents: 2251
diff changeset
  9400
    "return a string with the users login name (thats yours)"
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9401
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9402
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9403
    static char cachedName[64];
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9404
    static firstCall = 1;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9405
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9406
    char *name = (char *)0;
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  9407
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9408
#ifdef UNIX_LIKE
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  9409
# ifndef __openVMS__
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9410
    if (firstCall) {
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  9411
	name = (char *)getlogin();
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  9412
	if (! name || (name[0] == 0)) {
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  9413
	    name = (char *)getenv("LOGNAME");
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  9414
	}
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  9415
	if (name && (strlen(name) < sizeof(cachedName))) {
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  9416
	    strcpy(cachedName, name);
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  9417
	    firstCall = 0;
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  9418
	}
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9419
    } else {
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  9420
	name = cachedName;
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9421
    }
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  9422
# else /* openVMS */
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  9423
# endif
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9424
#else
1632
355409cd49d8 more for NT
Claus Gittinger <cg@exept.de>
parents: 1623
diff changeset
  9425
# ifdef WIN32
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9426
    if (firstCall) {
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  9427
	int nameSize = sizeof(cachedName);
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  9428
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  9429
	if (GetUserName(cachedName, &nameSize) == TRUE) {
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  9430
	    name = cachedName;
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  9431
	    firstCall = 0;
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  9432
	}
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9433
    } else {
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  9434
	name = cachedName;
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9435
    }
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9436
# endif
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9437
#endif
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9438
    /*
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9439
     * try a few common environment variables ...
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9440
     */
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9441
    if (! name || (name[0] == 0) ) {
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9442
	name = (char *)getenv("LOGIN");
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  9443
	if (! name || (name[0] == 0) ) {
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9444
	    name = (char *)getenv("LOGNAME");
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  9445
	    if (! name || (name[0] == 0) ) {
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  9446
		name = (char *)getenv("USER");
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  9447
	    }
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  9448
	}
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9449
    }
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9450
    /*
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9451
     * nope - I really font know who you are.
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9452
     */
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9453
    if (! name || (name[0] == 0) ) {
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  9454
	name = "you";
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9455
    }
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9456
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1675
diff changeset
  9457
    RETURN ( __MKSTRING(name) );
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9458
%}.
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9459
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9460
     OperatingSystem getLoginName
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9461
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9462
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9463
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9464
getUserID
1845
9d7e909b61dd some methods are compiled for space
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
  9465
    "{ Pragma: +optSpace }"
9d7e909b61dd some methods are compiled for space
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
  9466
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9467
    "return the current users (thats you) numeric user id"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9468
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9469
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9470
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9471
#ifdef UNIX_LIKE
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9472
    int uid;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9473
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9474
    uid = getuid();
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9475
    RETURN ( __MKSMALLINT(uid) );
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9476
#else
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9477
# ifdef SYSTEM_HAS_USERS
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9478
    /* ... */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9479
# endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9480
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9481
%}.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9482
    ^ 1 "just a dummy for systems which do not have userIDs"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9483
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9484
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9485
     OperatingSystem getUserID
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
  9486
    "
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9487
!
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9488
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9489
getUserNameFromID:aNumber
1845
9d7e909b61dd some methods are compiled for space
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
  9490
    "{ Pragma: +optSpace }"
9d7e909b61dd some methods are compiled for space
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
  9491
1549
df9d235c992e added #getFullUserNameFromID:, to access the GECOS field
Claus Gittinger <cg@exept.de>
parents: 1512
diff changeset
  9492
    "return the user-name-string for a given numeric user-id.
df9d235c992e added #getFullUserNameFromID:, to access the GECOS field
Claus Gittinger <cg@exept.de>
parents: 1512
diff changeset
  9493
     This is the login name, not the fullName."
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9494
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9495
%{  /* NOCONTEXT */
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9496
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9497
#ifdef UNIX_LIKE
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  9498
# ifndef NO_PWD
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9499
    struct passwd *p;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9500
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9501
    if (__isSmallInteger(aNumber)) {
1588
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  9502
	p = getpwuid(__intVal(aNumber));
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  9503
	if (p) {
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1675
diff changeset
  9504
	    RETURN ( __MKSTRING(p->pw_name) );
1588
0f9e80f6ae74 WANT_SYSTEM definition moved to sunIntern.h (for sunos)
Claus Gittinger <cg@exept.de>
parents: 1549
diff changeset
  9505
	}
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9506
    }
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  9507
# else
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  9508
#  ifdef __VMS__
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  9509
#  endif
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  9510
# endif
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  9511
#endif /* unix-like */
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9512
%}.
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  9513
    aNumber == self getUserID ifTrue:[
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  9514
	^ self getLoginName
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  9515
    ].
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  9516
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9517
    ^ '? (' , aNumber printString , ')'
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9518
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9519
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9520
     OperatingSystem getUserNameFromID:0
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9521
     OperatingSystem getUserNameFromID:100
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9522
     OperatingSystem getUserNameFromID:9991 
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9523
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  9524
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  9525
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9526
userInfoOf:aNameOrID
1845
9d7e909b61dd some methods are compiled for space
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
  9527
    "{ Pragma: +optSpace }"
9d7e909b61dd some methods are compiled for space
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
  9528
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9529
    "return a dictionary filled with userinfo. The argument can be either
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9530
     a string with the users name or its numeric id.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9531
     Notice, that not all systems provide (all of) this info;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9532
     DOS systems return nothing; 
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9533
     non-SYSV4 systems have no age/comment.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9534
     Portable applications may want to check the systemType and NOT depend
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9535
     on all keys to be present in the returned dictionary.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9536
     Another notice: on some systems (SYSV4), the gecos field includes multiple
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9537
     entries (i.e. not just the name), separated by commas. You may want to
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9538
     extract any substring, up to the first comma to get the real life name."
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9539
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9540
    |info name passw uid gid age comment
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9541
     gecos dir shell|
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9542
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9543
%{
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9544
#ifdef UNIX_LIKE
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  9545
# ifndef NO_PWD
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9546
    struct passwd *buf;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9547
    int ret;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9548
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9549
    if (__isString(aNameOrID)) {
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9550
	buf = getpwnam(__stringVal(aNameOrID));
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9551
    } else if (__isSmallInteger(aNameOrID)) {
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9552
	buf = getpwuid(__intVal(aNameOrID));
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9553
    } else {
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9554
	buf = (struct passwd *)0;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9555
    }
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9556
    if (buf) {
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1675
diff changeset
  9557
	name = __MKSTRING(buf->pw_name);
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  9558
#  ifndef NO_PWD_PASSWD
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1675
diff changeset
  9559
	passw = __MKSTRING(buf->pw_passwd);
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  9560
#  endif
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  9561
#  ifdef SYSV4
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1675
diff changeset
  9562
	age = __MKSTRING(buf->pw_age);
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1675
diff changeset
  9563
	comment = __MKSTRING(buf->pw_comment);
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  9564
#  endif
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1675
diff changeset
  9565
	dir = __MKSTRING(buf->pw_dir);
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  9566
#  ifndef NO_PWD_GECOS
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1675
diff changeset
  9567
	gecos = __MKSTRING(buf->pw_gecos);
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  9568
#  endif
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1675
diff changeset
  9569
	shell = __MKSTRING(buf->pw_shell);
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9570
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  9571
	uid = __MKSMALLINT(buf->pw_uid);
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  9572
	gid = __MKSMALLINT(buf->pw_gid);
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9573
    }
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  9574
# endif /* has PWD */
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9575
#endif
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9576
%}.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9577
    info := IdentityDictionary new.
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  9578
    name isNil ifTrue:[
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  9579
	aNameOrID == self getUserID ifTrue:[
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  9580
	    name := self getLoginName
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  9581
	].
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  9582
    ].
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9583
    name notNil ifTrue:[
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9584
	info at:#name put:name.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9585
    ] ifFalse:[
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9586
	info at:#name put:'unknown'
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9587
    ].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9588
    passw notNil ifTrue:[info at:#passwd put:passw].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9589
    age notNil ifTrue:[info at:#age put:age].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9590
    comment notNil ifTrue:[info at:#comment put:comment].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9591
    gecos notNil ifTrue:[info at:#gecos put:gecos].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9592
    shell notNil ifTrue:[info at:#shell put:shell].
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  9593
    dir isNil ifTrue:[
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  9594
	aNameOrID == self getUserID ifTrue:[
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  9595
	    dir := self getHomeDirectory
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  9596
	]
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  9597
    ].
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9598
    dir notNil ifTrue:[info at:#dir put:dir].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9599
    uid notNil ifTrue:[info at:#uid put:uid].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9600
    gid  notNil ifTrue:[info at:#gid put:gid].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9601
    ^ info
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9602
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9603
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9604
     OperatingSystem userInfoOf:'root'
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9605
     OperatingSystem userInfoOf:1
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9606
     OperatingSystem userInfoOf:'claus' 
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9607
     OperatingSystem userInfoOf:'fooBar' 
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9608
     OperatingSystem userInfoOf:(OperatingSystem getUserID)
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9609
    "
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9610
! !
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9611
1799
0a2c5890f4f3 handle 'foo///' in directoryName
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
  9612
!OperatingSystem class methodsFor:'waiting for events'!
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9613
840
523533898acd Reset sigCHLD interrupt handler, when no more processes are being waited for.
Stefan Vogel <sv@exept.de>
parents: 832
diff changeset
  9614
blockingChildProcessWait
2959
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  9615
     "return true, if childProcessWait: blocks, if no children are ready.
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  9616
      On those systems, we must be somewhat careful when looking out for
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  9617
      a subprocesses status (to avoid blocking)."
2612
83eef9ec13c7 fixed davids monitorPid & childWaut implementation
Claus Gittinger <cg@exept.de>
parents: 2609
diff changeset
  9618
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  9619
%{ /*NOCONTEXT*/
2959
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  9620
#if defined(HAS_WAITPID) || defined(HAS_WAIT3) || defined(WIN32) || defined(__VMS__)
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  9621
    RETURN(false);
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  9622
#else
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  9623
    RETURN(true);
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  9624
#endif
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  9625
%}
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  9626
!
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
  9627
2959
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  9628
childProcessWait:blocking pid:pidToWait
2592
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  9629
    "{ Pragma: +optSpace }"
86ad6e498d8d many NT changes
Claus Gittinger <cg@exept.de>
parents: 2571
diff changeset
  9630
840
523533898acd Reset sigCHLD interrupt handler, when no more processes are being waited for.
Stefan Vogel <sv@exept.de>
parents: 832
diff changeset
  9631
    "get status changes from child processes.
523533898acd Reset sigCHLD interrupt handler, when no more processes are being waited for.
Stefan Vogel <sv@exept.de>
parents: 832
diff changeset
  9632
     Return an OSProcessStatus or nil, if no process has terminated.
523533898acd Reset sigCHLD interrupt handler, when no more processes are being waited for.
Stefan Vogel <sv@exept.de>
parents: 832
diff changeset
  9633
     If blocking is true, we wait until a process changed state, 
2612
83eef9ec13c7 fixed davids monitorPid & childWaut implementation
Claus Gittinger <cg@exept.de>
parents: 2609
diff changeset
  9634
     otherwise we return immediately.
83eef9ec13c7 fixed davids monitorPid & childWaut implementation
Claus Gittinger <cg@exept.de>
parents: 2609
diff changeset
  9635
     Note that win32 needs to know the HANDLE of the process on which 
83eef9ec13c7 fixed davids monitorPid & childWaut implementation
Claus Gittinger <cg@exept.de>
parents: 2609
diff changeset
  9636
     it waits.  In case of an error, THIS ALWAYS WAITS and then times out."
840
523533898acd Reset sigCHLD interrupt handler, when no more processes are being waited for.
Stefan Vogel <sv@exept.de>
parents: 832
diff changeset
  9637
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  9638
    |pid status code core|
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  9639
%{
2612
83eef9ec13c7 fixed davids monitorPid & childWaut implementation
Claus Gittinger <cg@exept.de>
parents: 2609
diff changeset
  9640
#ifdef WIN32
83eef9ec13c7 fixed davids monitorPid & childWaut implementation
Claus Gittinger <cg@exept.de>
parents: 2609
diff changeset
  9641
    DWORD endStatus;
83eef9ec13c7 fixed davids monitorPid & childWaut implementation
Claus Gittinger <cg@exept.de>
parents: 2609
diff changeset
  9642
 
2959
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  9643
    if (__isExternalAddress(pidToWait) ) {
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  9644
	endStatus = WaitForSingleObject( _HANDLEVal(pidToWait), blocking==true ? INFINITE : 0 );
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  9645
	if ( endStatus == WAIT_TIMEOUT ) {
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  9646
	     status = @symbol(timeout);
2612
83eef9ec13c7 fixed davids monitorPid & childWaut implementation
Claus Gittinger <cg@exept.de>
parents: 2609
diff changeset
  9647
	     /* mhmh david - shouln't we return nil here ? */
2959
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  9648
	     RETURN(nil);
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  9649
	} else {
2612
83eef9ec13c7 fixed davids monitorPid & childWaut implementation
Claus Gittinger <cg@exept.de>
parents: 2609
diff changeset
  9650
	     status = @symbol(exit);
83eef9ec13c7 fixed davids monitorPid & childWaut implementation
Claus Gittinger <cg@exept.de>
parents: 2609
diff changeset
  9651
	}
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  9652
	code = __MKSMALLINT(endStatus);
2612
83eef9ec13c7 fixed davids monitorPid & childWaut implementation
Claus Gittinger <cg@exept.de>
parents: 2609
diff changeset
  9653
	core = false;
83eef9ec13c7 fixed davids monitorPid & childWaut implementation
Claus Gittinger <cg@exept.de>
parents: 2609
diff changeset
  9654
    }
83eef9ec13c7 fixed davids monitorPid & childWaut implementation
Claus Gittinger <cg@exept.de>
parents: 2609
diff changeset
  9655
#endif
83eef9ec13c7 fixed davids monitorPid & childWaut implementation
Claus Gittinger <cg@exept.de>
parents: 2609
diff changeset
  9656
2959
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  9657
#ifdef __VMS__
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  9658
    {
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  9659
	long endStatus, endPid;
2959
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  9660
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  9661
	if (! __vms_waitPid(-1, &endStatus, &endPid)) {
2959
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  9662
	    /*
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  9663
	     * no process finished
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  9664
	     */
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  9665
	    RETURN(nil);
2959
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  9666
	}
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  9667
	status = @symbol(exit);
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  9668
	code = __MKUINT(endStatus);
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  9669
	pid = __MKUINT(endPid);
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  9670
	core = false;
2959
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  9671
    }
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  9672
#endif /* __VMS__ */
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  9673
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  9674
#if defined(UNIX_LIKE) && !defined(__VMS__)
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  9675
    int p;
1653
51bd45bcc19d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1633
diff changeset
  9676
1597
f35cd92a7648 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1588
diff changeset
  9677
# if defined(HAS_WAITPID)
1653
51bd45bcc19d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1633
diff changeset
  9678
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  9679
    int s;
1653
51bd45bcc19d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1633
diff changeset
  9680
#   define __WAIT     waitpid(-1, &s, blocking == true ? WUNTRACED : WNOHANG|WUNTRACED)
51bd45bcc19d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1633
diff changeset
  9681
1597
f35cd92a7648 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1588
diff changeset
  9682
# else
f35cd92a7648 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1588
diff changeset
  9683
#  if defined(HAS_WAIT3)
1653
51bd45bcc19d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1633
diff changeset
  9684
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  9685
    union wait s;
1653
51bd45bcc19d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1633
diff changeset
  9686
#   define __WAIT      wait3(&s, blocking == true ? WUNTRACED : WNOHANG|WUNTRACED, 0)
51bd45bcc19d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1633
diff changeset
  9687
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  9688
#  else /* neither waitpid, nor wait3; use wait, which is blocking */
1653
51bd45bcc19d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1633
diff changeset
  9689
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  9690
    int s;
1653
51bd45bcc19d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1633
diff changeset
  9691
#   define __WAIT      wait(&s)
51bd45bcc19d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1633
diff changeset
  9692
#   define __BLOCKING_WAIT__ 1
1597
f35cd92a7648 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1588
diff changeset
  9693
1654
4352c5837f37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  9694
    if (blocking != true) {
4352c5837f37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  9695
	/*
4352c5837f37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  9696
	 * We do not support nonBlocking waits, so signal an error
4352c5837f37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  9697
	 * Sorry about the goto, but with all these ifdefs ...
4352c5837f37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  9698
	 */
4352c5837f37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  9699
	goto done;
4352c5837f37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  9700
    }
4352c5837f37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  9701
#  endif /*!HAS_WAIT3*/
4352c5837f37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  9702
# endif  /*!HAS_WAITPID*/
4352c5837f37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  9703
2098
8790a0a6b214 WIFEXIT...WCOREDUMP are always needed
Claus Gittinger <cg@exept.de>
parents: 2080
diff changeset
  9704
# if !defined(WIFEXITED)
8790a0a6b214 WIFEXIT...WCOREDUMP are always needed
Claus Gittinger <cg@exept.de>
parents: 2080
diff changeset
  9705
#  define WIFEXITED(stat)      (((int)((stat)&0377))==0)
8790a0a6b214 WIFEXIT...WCOREDUMP are always needed
Claus Gittinger <cg@exept.de>
parents: 2080
diff changeset
  9706
#  define WIFSIGNALED(stat)    (((int)((stat)&0377))>0&&((int)(((stat)>>8)&0377))==0)
8790a0a6b214 WIFEXIT...WCOREDUMP are always needed
Claus Gittinger <cg@exept.de>
parents: 2080
diff changeset
  9707
#  define WIFSTOPPED(stat)     (((int)((stat)&0377))==0177&&((int)(((stat)>>8)&0377))!=0)
8790a0a6b214 WIFEXIT...WCOREDUMP are always needed
Claus Gittinger <cg@exept.de>
parents: 2080
diff changeset
  9708
8790a0a6b214 WIFEXIT...WCOREDUMP are always needed
Claus Gittinger <cg@exept.de>
parents: 2080
diff changeset
  9709
#  define WEXITSTATUS(stat)    ((int)(((stat)>>8)&0377))
8790a0a6b214 WIFEXIT...WCOREDUMP are always needed
Claus Gittinger <cg@exept.de>
parents: 2080
diff changeset
  9710
#  define WTERMSIG(stat)       (((int)((stat)&0377))&0177)
8790a0a6b214 WIFEXIT...WCOREDUMP are always needed
Claus Gittinger <cg@exept.de>
parents: 2080
diff changeset
  9711
#  define WSTOPSIG(stat)       ((int)(((stat)>>8)&0377))
8790a0a6b214 WIFEXIT...WCOREDUMP are always needed
Claus Gittinger <cg@exept.de>
parents: 2080
diff changeset
  9712
# endif /*!WIFEXITED*/
8790a0a6b214 WIFEXIT...WCOREDUMP are always needed
Claus Gittinger <cg@exept.de>
parents: 2080
diff changeset
  9713
8790a0a6b214 WIFEXIT...WCOREDUMP are always needed
Claus Gittinger <cg@exept.de>
parents: 2080
diff changeset
  9714
# if !defined(WCOREDUMP)
2896
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  9715
   /*
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  9716
    * some systems lack that definition, although the field is there ...
be30640b9012 VMS stuff
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  9717
    */
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  9718
#  if defined(HAS_WAIT3)
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  9719
#   define WCOREDUMP(status)    (((union __wait*)&(status))->__w_coredump)
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  9720
#  else
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  9721
#   define WCOREDUMP(status)    ((int)(((status)>>8)&0200))
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  9722
#  endif
2098
8790a0a6b214 WIFEXIT...WCOREDUMP are always needed
Claus Gittinger <cg@exept.de>
parents: 2080
diff changeset
  9723
# endif /*!WCOREDUMP*/
1597
f35cd92a7648 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1588
diff changeset
  9724
f35cd92a7648 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1588
diff changeset
  9725
# if __BLOCKING_WAIT__
1433
8b2eacaea59c Getdomainname for Unixware.
Stefan Vogel <sv@exept.de>
parents: 1422
diff changeset
  9726
    __BEGIN_INTERRUPTABLE__
1597
f35cd92a7648 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1588
diff changeset
  9727
# endif
1433
8b2eacaea59c Getdomainname for Unixware.
Stefan Vogel <sv@exept.de>
parents: 1422
diff changeset
  9728
840
523533898acd Reset sigCHLD interrupt handler, when no more processes are being waited for.
Stefan Vogel <sv@exept.de>
parents: 832
diff changeset
  9729
    do {
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  9730
	p = __WAIT;
840
523533898acd Reset sigCHLD interrupt handler, when no more processes are being waited for.
Stefan Vogel <sv@exept.de>
parents: 832
diff changeset
  9731
    } while (p == -1 && errno == EINTR);
523533898acd Reset sigCHLD interrupt handler, when no more processes are being waited for.
Stefan Vogel <sv@exept.de>
parents: 832
diff changeset
  9732
1597
f35cd92a7648 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1588
diff changeset
  9733
# if __BLOCKING_WAIT__
1433
8b2eacaea59c Getdomainname for Unixware.
Stefan Vogel <sv@exept.de>
parents: 1422
diff changeset
  9734
    __END_INTERRUPTABLE__
1654
4352c5837f37 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  9735
#   undef __BLOCKING_WAIT__
1597
f35cd92a7648 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1588
diff changeset
  9736
# endif
f35cd92a7648 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1588
diff changeset
  9737
f35cd92a7648 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1588
diff changeset
  9738
# undef __WAIT
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  9739
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  9740
    if (p == 0)
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  9741
	RETURN(nil)
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  9742
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  9743
    if (p == -1) {
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  9744
	if (errno == ECHILD)
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  9745
	    RETURN(nil);
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  9746
    } else {
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  9747
	pid = __MKSMALLINT(p);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  9748
	if (WIFEXITED(s)) {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  9749
	    status = @symbol(exit);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  9750
	    code = __MKSMALLINT(WEXITSTATUS(s));
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  9751
	    core = WCOREDUMP(s) ? true : false;
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  9752
	} else if (WIFSIGNALED(s)) {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  9753
	    status = @symbol(signal);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  9754
	    code = __MKSMALLINT(WTERMSIG(s));
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  9755
	} else if (WIFSTOPPED(s)) {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  9756
	    status = @symbol(stop);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  9757
	    code = __MKSMALLINT(WSTOPSIG(s));
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  9758
	}
1597
f35cd92a7648 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1588
diff changeset
  9759
# if defined(WIFCONTINUED)
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  9760
	else if (WIFCONTINUED(s)) {
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  9761
	    status = @symbol(continue);
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  9762
	} 
1597
f35cd92a7648 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1588
diff changeset
  9763
# endif
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  9764
    }
840
523533898acd Reset sigCHLD interrupt handler, when no more processes are being waited for.
Stefan Vogel <sv@exept.de>
parents: 832
diff changeset
  9765
done: ;
1597
f35cd92a7648 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1588
diff changeset
  9766
#endif /* UNIX_LIKE */
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  9767
%}.
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  9768
2612
83eef9ec13c7 fixed davids monitorPid & childWaut implementation
Claus Gittinger <cg@exept.de>
parents: 2609
diff changeset
  9769
    (status isNil or:[pid isNil]) ifTrue:[
1487
349bf72ca044 nt fixes
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  9770
	^ self primitiveFailed
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  9771
    ].
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  9772
2983
41ff593bd359 removed a debugPrint
Claus Gittinger <cg@exept.de>
parents: 2981
diff changeset
  9773
"/ Transcript show:'pid: '; show:pid; show:' status: '; show:status;
41ff593bd359 removed a debugPrint
Claus Gittinger <cg@exept.de>
parents: 2981
diff changeset
  9774
"/ show:' code: '; show:code; show:' core:'; showCR:core.
2968
260a66f9f4e2 lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2959
diff changeset
  9775
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  9776
    ^ OSProcessStatus pid:pid status:status code:code core:core
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  9777
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  9778
    "
840
523533898acd Reset sigCHLD interrupt handler, when no more processes are being waited for.
Stefan Vogel <sv@exept.de>
parents: 832
diff changeset
  9779
     OperatingSystem childProcessWait:false
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  9780
    "
840
523533898acd Reset sigCHLD interrupt handler, when no more processes are being waited for.
Stefan Vogel <sv@exept.de>
parents: 832
diff changeset
  9781
523533898acd Reset sigCHLD interrupt handler, when no more processes are being waited for.
Stefan Vogel <sv@exept.de>
parents: 832
diff changeset
  9782
    "Created: 5.1.1996 / 16:39:14 / stefan"
827
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  9783
!
3eb3911cb63e Support of SIGCHL interrupt handling and OS-independent proces status
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  9784
10
claus
parents: 5
diff changeset
  9785
readCheck:fd
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9786
    "return true, if data is available on a filedescriptor 
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9787
     (i.e. read is possible without blocking).
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9788
     This depends on a working select or FIONREAD to be provided by the OS."
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9789
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9790
%{
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9791
    /*
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9792
     * if available, try FIONREAD first, which is usually done faster.
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9793
     */
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9794
# ifdef FIONREAD
2975
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  9795
    {
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  9796
	int n;
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  9797
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  9798
	if (__isSmallInteger(fd)) {
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  9799
	    if (n = ioctl(__intVal(fd), FIONREAD) {
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  9800
		printf("FIONREAD returns %d\n", n);
2975
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  9801
	    }
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  9802
	}
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9803
    }
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9804
# endif /* FIONREAD */
2975
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  9805
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  9806
# ifdef __VMS__
2981
be69407cb552 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2976
diff changeset
  9807
#  ifdef DOES_NOT_WORK_YET
2975
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  9808
    {
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  9809
	/*
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  9810
	 * do a sys$qio ..
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  9811
	 * fd here is suposed to be a channel nr.
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  9812
	 */
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  9813
	struct IOSB iosb;
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  9814
	int status;
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  9815
	int channel;
2975
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  9816
	struct typahdask sensebuf;
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  9817
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  9818
	if (__isSmallInteger(fd)) {
2975
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  9819
	    channel = __intVal(fd);
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  9820
	    status = SYS$QIO(0, /* efn */
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  9821
			     channel,
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  9822
			     IO$_SENSEMODE | IO$M_TYPEAHDCNT,
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  9823
			     &iosb,
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  9824
			     0, /* ast */
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  9825
			     0, /* ast arg */
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  9826
			     &sensebuf,         /* data */
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  9827
			     sizeof(sensebuf),  /* data size */
2975
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  9828
			     0, 0, 0, 0);
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  9829
	    if (status != SS$_NORMAL) {
2976
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  9830
		fprintf(stderr, "OS [info]: SYS$QIO failed on %d\n", channel);
2975
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  9831
	    } else {
2976
dcb3a0f7f2f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  9832
		fprintf(stderr, "sys$QIO -> %d\n", sensebuf.typcnt);
2975
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  9833
	    }
2990
86d7ef828d26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2983
diff changeset
  9834
	}
2975
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  9835
    }
2981
be69407cb552 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2976
diff changeset
  9836
#  endif
2975
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  9837
# endif /* __VMS__ */
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9838
%}.
2959
ef8cc5a5a19f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2949
diff changeset
  9839
2972
0c50c90e6557 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2968
diff changeset
  9840
    self supportsSelect ifFalse:[
0c50c90e6557 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2968
diff changeset
  9841
	"/ mhmh - what should we do then ?
0c50c90e6557 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2968
diff changeset
  9842
	"/ For now, return true as if data was present,
0c50c90e6557 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2968
diff changeset
  9843
	"/ and let the thread fall into the read.
0c50c90e6557 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2968
diff changeset
  9844
	"/ It will then (hopefully) be desceduled there and
0c50c90e6557 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2968
diff changeset
  9845
	"/ effectively polling for input.
2975
3660dcc8091a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2973
diff changeset
  9846
2972
0c50c90e6557 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2968
diff changeset
  9847
	^ true
0c50c90e6557 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2968
diff changeset
  9848
    ].
0c50c90e6557 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2968
diff changeset
  9849
10
claus
parents: 5
diff changeset
  9850
    (self selectOnAnyReadable:(Array with:fd)
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  9851
		     writable:nil
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  9852
		    exception:nil
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  9853
		  withTimeOut:0) == fd
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  9854
	ifTrue:[^ true].
10
claus
parents: 5
diff changeset
  9855
    ^ false
claus
parents: 5
diff changeset
  9856
!
claus
parents: 5
diff changeset
  9857
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9858
selectOn:fd1 and:fd2 withTimeOut:millis
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9859
    "wait for any fd to become ready; timeout after t milliseconds.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9860
     A zero timeout-time will immediately return (i.e. poll).
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9861
     Return fd if i/o ok, nil if timed-out or interrupted.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9862
     Obsolete:
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9863
	This is a leftover method and will vanish."
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9864
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9865
    ^ self selectOnAnyReadable:(Array with:fd1 with:fd2)
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9866
		      writable:(Array with:fd1 with:fd2)
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9867
		     exception:nil
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9868
		   withTimeOut:millis
10
claus
parents: 5
diff changeset
  9869
!
claus
parents: 5
diff changeset
  9870
claus
parents: 5
diff changeset
  9871
selectOn:fd withTimeOut:millis
claus
parents: 5
diff changeset
  9872
    "wait for aFileDesriptor to become ready; timeout after t milliseconds.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  9873
     Return true, if i/o ok, false if timed-out or interrupted.
a27a279701f8 Initial revision
claus
parents:
diff changeset
  9874
     With 0 as timeout argument, this can be used to check for availability
a27a279701f8 Initial revision
claus
parents:
diff changeset
  9875
     of read-data.
a27a279701f8 Initial revision
claus
parents:
diff changeset
  9876
     Experimental."
a27a279701f8 Initial revision
claus
parents:
diff changeset
  9877
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
  9878
    ^ self selectOnAnyReadable:(Array with:fd)
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  9879
		      writable:(Array with:fd)
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  9880
		     exception:nil
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  9881
		   withTimeOut:millis
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  9882
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  9883
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9884
selectOnAny:fdArray withTimeOut:millis
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9885
    "wait for any fd in fdArray (an Array of integers) to become ready;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9886
     timeout after t milliseconds. An empty set will always wait.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9887
     Return first ready fd if i/o ok, nil if timed-out or interrupted.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9888
     Experimental."
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9889
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9890
    ^ self selectOnAnyReadable:fdArray
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  9891
		      writable:fdArray
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  9892
		     exception:nil
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  9893
		   withTimeOut:millis
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  9894
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  9895
10
claus
parents: 5
diff changeset
  9896
selectOnAnyReadable:fdArray withTimeOut:millis
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9897
    "wait for any fd in fdArray (an Array of integers) to become ready for 
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9898
     reading. Timeout after t milliseconds. An empty set will always wait.
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9899
     A zero timeout-time will immediately return (i.e. poll).
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
  9900
     Return first ready fd if i/o ok, nil if timed-out or interrupted.
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
  9901
     Experimental."
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
  9902
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
  9903
    ^ self selectOnAnyReadable:fdArray 
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  9904
		      writable:nil 
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  9905
		     exception:nil
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
  9906
		   withTimeOut:millis
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
  9907
!
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
  9908
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9909
selectOnAnyReadable:readFdArray writable:writeFdArray exception:exceptFdArray withTimeOut:millis
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9910
    "wait for any fd in readFdArray (an Array of integers) to become ready for 
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9911
     reading, writeFdArray to become ready for writing, or exceptFdArray to 
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9912
     arrive exceptional data (i.e. out-of-band data).
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9913
     Timeout after t milliseconds or, if the timeout time is 0, immediately..
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9914
     Empty fd-sets will always wait. Zero time can be used to poll file-
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9915
     descriptors (i.e. to check if I/O possible without blocking).
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
  9916
     Return first ready fd if I/O ok, nil if timed-out or interrupted."
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
  9917
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  9918
%{
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9919
#ifdef MSDOS_LIKE
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9920
    /*
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9921
     * support a delay-wait only
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9922
     * (i.e. fail if any filedescriptor is selected upon)
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9923
     */
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9924
    int count;
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9925
    int i;
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9926
    int t;
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9927
    OBJ fd;
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9928
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9929
    if (! __isSmallInteger(millis)) {
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9930
	goto fail;
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9931
    }
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9932
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9933
    if (readFdArray != nil) {
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  9934
	if (! __isArray(readFdArray)) {
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  9935
	    goto fail;  
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9936
	}
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9937
	count = __arraySize(readFdArray);
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9938
	for (i=0; i<count;i++) {
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  9939
	    fd = __ArrayInstPtr(readFdArray)->a_element[i];
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9940
	    if (fd != nil) {
2624
53fac5798cdd ignore negative fd's in select
Claus Gittinger <cg@exept.de>
parents: 2621
diff changeset
  9941
		if (__isSmallInteger(fd) && (__intVal(fd) >= 0)) {
53fac5798cdd ignore negative fd's in select
Claus Gittinger <cg@exept.de>
parents: 2621
diff changeset
  9942
		    goto fail;
53fac5798cdd ignore negative fd's in select
Claus Gittinger <cg@exept.de>
parents: 2621
diff changeset
  9943
		}
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9944
	    }
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9945
	}
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9946
    }
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9947
    if (writeFdArray != nil) {
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9948
	if (! __isArray(writeFdArray)) {
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9949
	    goto fail;
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9950
	}
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9951
	count = __arraySize(writeFdArray);
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9952
	for (i=0; i<count;i++) {
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  9953
	    fd = __ArrayInstPtr(writeFdArray)->a_element[i];
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9954
	    if (fd != nil) {
2624
53fac5798cdd ignore negative fd's in select
Claus Gittinger <cg@exept.de>
parents: 2621
diff changeset
  9955
		if (__isSmallInteger(fd) && (__intVal(fd) >= 0)) {
53fac5798cdd ignore negative fd's in select
Claus Gittinger <cg@exept.de>
parents: 2621
diff changeset
  9956
		    goto fail;
53fac5798cdd ignore negative fd's in select
Claus Gittinger <cg@exept.de>
parents: 2621
diff changeset
  9957
		}
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9958
	    }
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9959
	}
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9960
    }
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9961
    if (exceptFdArray != nil) {
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9962
	if (! __isArray(exceptFdArray)) {
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9963
	    goto fail;
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9964
	}
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9965
	count = __arraySize(exceptFdArray);
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9966
	for (i=0; i<count;i++) {
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  9967
	    fd = __ArrayInstPtr(exceptFdArray)->a_element[i];
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9968
	    if (fd != nil) {
2624
53fac5798cdd ignore negative fd's in select
Claus Gittinger <cg@exept.de>
parents: 2621
diff changeset
  9969
		if (__isSmallInteger(fd) && (__intVal(fd) >= 0)) {
53fac5798cdd ignore negative fd's in select
Claus Gittinger <cg@exept.de>
parents: 2621
diff changeset
  9970
		    goto fail;
53fac5798cdd ignore negative fd's in select
Claus Gittinger <cg@exept.de>
parents: 2621
diff changeset
  9971
		}
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9972
	    }
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9973
	}
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9974
    }
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
  9975
    t = __intVal(millis);
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9976
    if (t != 0) {
2631
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  9977
# if !defined(WIN32) || defined(WIN32s)
947
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  9978
	/*
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  9979
	 * delay only 
2d067b1d716c added a method to fetch a unix processes' exitStatus (to avoid zombies)
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  9980
	 */
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9981
	Sleep(t);
2631
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  9982
# else /* NT or WIN95 */
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  9983
	HANDLE dummyHandle = (HANDLE)0;
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  9984
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  9985
	/*
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  9986
	 * notice: MsgWait blocks if there is already a message in the q.
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
  9987
	 * (brain damage behavior) therefore, check queueStatus before
2631
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  9988
	 */
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  9989
	if (! GetQueueStatus(QS_ALLINPUT)) {
2776
1cc4e9788f0d fixed pathOfCOmmand (care for '.' in path);
Claus Gittinger <cg@exept.de>
parents: 2756
diff changeset
  9990
	    MsgWaitForMultipleObjects(0, &dummyHandle, FALSE, t, QS_ALLINPUT);
2631
48f629517b65 more systemInfo stuff (Windows); moved timer stuff completely into librun.
Claus Gittinger <cg@exept.de>
parents: 2628
diff changeset
  9991
	}
2904
3a776398ff05 various VMS changes
Claus Gittinger <cg@exept.de>
parents: 2896
diff changeset
  9992
# endif /* NT or WIN95 */
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9993
    }
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9994
    RETURN (nil);
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9995
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9996
#else /* not MSDOS_LIKE */
2624
53fac5798cdd ignore negative fd's in select
Claus Gittinger <cg@exept.de>
parents: 2621
diff changeset
  9997
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  9998
    fd_set rset, wset, eset;
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  9999
    struct timeval wt, et;
2795
6fbdb5ccda8b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2788
diff changeset
 10000
    int f, maxF, i, lX, bX;
6fbdb5ccda8b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2788
diff changeset
 10001
    INT t;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
 10002
    OBJ fd, retFd;
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
 10003
    int ret;
300
fe1f742a9224 *** empty log message ***
claus
parents: 275
diff changeset
 10004
    int count;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
 10005
252
 10006
    if (__isSmallInteger(millis)) {
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
 10007
	FD_ZERO(&rset);
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
 10008
	FD_ZERO(&wset);
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
 10009
	FD_ZERO(&eset);
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
 10010
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
 10011
	maxF = -1;
308
f04744ef7b5d *** empty log message ***
claus
parents: 300
diff changeset
 10012
	if (readFdArray != nil) {
300
fe1f742a9224 *** empty log message ***
claus
parents: 275
diff changeset
 10013
	    if (! __isArray(readFdArray)) {
fe1f742a9224 *** empty log message ***
claus
parents: 275
diff changeset
 10014
		goto fail;    
fe1f742a9224 *** empty log message ***
claus
parents: 275
diff changeset
 10015
	    }
fe1f742a9224 *** empty log message ***
claus
parents: 275
diff changeset
 10016
	    count = __arraySize(readFdArray);
308
f04744ef7b5d *** empty log message ***
claus
parents: 300
diff changeset
 10017
f04744ef7b5d *** empty log message ***
claus
parents: 300
diff changeset
 10018
	    for (i=0; i<count;i++) {
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
 10019
		fd = __ArrayInstPtr(readFdArray)->a_element[i];
308
f04744ef7b5d *** empty log message ***
claus
parents: 300
diff changeset
 10020
		if (fd != nil) {
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
 10021
		    f = __intVal(fd);
2778
2206a2ef0e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
 10022
		    if ((unsigned)f < FD_SETSIZE) {
308
f04744ef7b5d *** empty log message ***
claus
parents: 300
diff changeset
 10023
			FD_SET(f, &rset);
f04744ef7b5d *** empty log message ***
claus
parents: 300
diff changeset
 10024
			if (f > maxF) maxF = f;
f04744ef7b5d *** empty log message ***
claus
parents: 300
diff changeset
 10025
		    }
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
 10026
		}
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
 10027
	    }
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
 10028
	}
300
fe1f742a9224 *** empty log message ***
claus
parents: 275
diff changeset
 10029
308
f04744ef7b5d *** empty log message ***
claus
parents: 300
diff changeset
 10030
	if (writeFdArray != nil) {
300
fe1f742a9224 *** empty log message ***
claus
parents: 275
diff changeset
 10031
	    if (! __isArray(writeFdArray)) {
fe1f742a9224 *** empty log message ***
claus
parents: 275
diff changeset
 10032
		goto fail;    
fe1f742a9224 *** empty log message ***
claus
parents: 275
diff changeset
 10033
	    }
fe1f742a9224 *** empty log message ***
claus
parents: 275
diff changeset
 10034
	    count = __arraySize(writeFdArray);
308
f04744ef7b5d *** empty log message ***
claus
parents: 300
diff changeset
 10035
	    for (i=0; i<count;i++) {
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
 10036
		fd = __ArrayInstPtr(writeFdArray)->a_element[i];
308
f04744ef7b5d *** empty log message ***
claus
parents: 300
diff changeset
 10037
		if (fd != nil) {
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
 10038
		    f = __intVal(fd);
2778
2206a2ef0e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
 10039
		    if ((unsigned)f < FD_SETSIZE) {
308
f04744ef7b5d *** empty log message ***
claus
parents: 300
diff changeset
 10040
			FD_SET(f, &wset);       
f04744ef7b5d *** empty log message ***
claus
parents: 300
diff changeset
 10041
			if (f > maxF) maxF = f;
f04744ef7b5d *** empty log message ***
claus
parents: 300
diff changeset
 10042
		    }
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
 10043
		}
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
 10044
	    }
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
 10045
	}
300
fe1f742a9224 *** empty log message ***
claus
parents: 275
diff changeset
 10046
308
f04744ef7b5d *** empty log message ***
claus
parents: 300
diff changeset
 10047
	if (exceptFdArray != nil) {
300
fe1f742a9224 *** empty log message ***
claus
parents: 275
diff changeset
 10048
	    if (! __isArray(exceptFdArray)) {
fe1f742a9224 *** empty log message ***
claus
parents: 275
diff changeset
 10049
		goto fail;    
fe1f742a9224 *** empty log message ***
claus
parents: 275
diff changeset
 10050
	    }
fe1f742a9224 *** empty log message ***
claus
parents: 275
diff changeset
 10051
	    count = __arraySize(exceptFdArray);
308
f04744ef7b5d *** empty log message ***
claus
parents: 300
diff changeset
 10052
	    for (i=0; i<count;i++) {
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
 10053
		fd = __ArrayInstPtr(exceptFdArray)->a_element[i];
308
f04744ef7b5d *** empty log message ***
claus
parents: 300
diff changeset
 10054
		if (fd != nil) {
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
 10055
		    f = __intVal(fd);
2778
2206a2ef0e0a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
 10056
		    if ((unsigned)f < FD_SETSIZE) {
308
f04744ef7b5d *** empty log message ***
claus
parents: 300
diff changeset
 10057
			FD_SET(f, &eset);       
f04744ef7b5d *** empty log message ***
claus
parents: 300
diff changeset
 10058
			if (f > maxF) maxF = f;
f04744ef7b5d *** empty log message ***
claus
parents: 300
diff changeset
 10059
		    }
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
 10060
		}
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
 10061
	    }
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
 10062
	}
308
f04744ef7b5d *** empty log message ***
claus
parents: 300
diff changeset
 10063
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
 10064
	t = __intVal(millis);
774
e0ee05157570 selectOnAny with timeout vs. no timeout
Claus Gittinger <cg@exept.de>
parents: 771
diff changeset
 10065
	if (t) {
e0ee05157570 selectOnAny with timeout vs. no timeout
Claus Gittinger <cg@exept.de>
parents: 771
diff changeset
 10066
	    wt.tv_sec = t / 1000;
e0ee05157570 selectOnAny with timeout vs. no timeout
Claus Gittinger <cg@exept.de>
parents: 771
diff changeset
 10067
	    wt.tv_usec = (t % 1000) * 1000;
e0ee05157570 selectOnAny with timeout vs. no timeout
Claus Gittinger <cg@exept.de>
parents: 771
diff changeset
 10068
	} else {
e0ee05157570 selectOnAny with timeout vs. no timeout
Claus Gittinger <cg@exept.de>
parents: 771
diff changeset
 10069
	    wt.tv_sec = wt.tv_usec = 0;
e0ee05157570 selectOnAny with timeout vs. no timeout
Claus Gittinger <cg@exept.de>
parents: 771
diff changeset
 10070
	}
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
 10071
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
 10072
	/*
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
 10073
	 * make certain, that interrupt gets us out of the select
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
 10074
	 */
362
claus
parents: 359
diff changeset
 10075
	__BEGIN_INTERRUPTABLE__
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
 10076
	errno = 0;
774
e0ee05157570 selectOnAny with timeout vs. no timeout
Claus Gittinger <cg@exept.de>
parents: 771
diff changeset
 10077
e0ee05157570 selectOnAny with timeout vs. no timeout
Claus Gittinger <cg@exept.de>
parents: 771
diff changeset
 10078
	if (t == 0) {
e0ee05157570 selectOnAny with timeout vs. no timeout
Claus Gittinger <cg@exept.de>
parents: 771
diff changeset
 10079
	    /* 
e0ee05157570 selectOnAny with timeout vs. no timeout
Claus Gittinger <cg@exept.de>
parents: 771
diff changeset
 10080
	     * if there is no timeout time, we can stay here 
e0ee05157570 selectOnAny with timeout vs. no timeout
Claus Gittinger <cg@exept.de>
parents: 771
diff changeset
 10081
	     * interruptable.
e0ee05157570 selectOnAny with timeout vs. no timeout
Claus Gittinger <cg@exept.de>
parents: 771
diff changeset
 10082
	     */
e0ee05157570 selectOnAny with timeout vs. no timeout
Claus Gittinger <cg@exept.de>
parents: 771
diff changeset
 10083
	    do {
e0ee05157570 selectOnAny with timeout vs. no timeout
Claus Gittinger <cg@exept.de>
parents: 771
diff changeset
 10084
		ret = select(maxF+1, &rset, &wset, &eset, &wt);
e0ee05157570 selectOnAny with timeout vs. no timeout
Claus Gittinger <cg@exept.de>
parents: 771
diff changeset
 10085
	    } while ((ret < 0) && (errno == EINTR));
e0ee05157570 selectOnAny with timeout vs. no timeout
Claus Gittinger <cg@exept.de>
parents: 771
diff changeset
 10086
	} else {
e0ee05157570 selectOnAny with timeout vs. no timeout
Claus Gittinger <cg@exept.de>
parents: 771
diff changeset
 10087
	    do {
813
1f9611434418 first stuff for locale support added
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
 10088
		ret = select(maxF+1, &rset, &wset, &eset, &wt);
1f9611434418 first stuff for locale support added
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
 10089
		/* 
1f9611434418 first stuff for locale support added
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
 10090
		 * for now: dont loop; if we did, we had to adjust the vt-timeval;
1f9611434418 first stuff for locale support added
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
 10091
		 * could otherwise stay in this loop forever ...
1f9611434418 first stuff for locale support added
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
 10092
		 * Premature return (before the time expired) must be handled by the caller.
774
e0ee05157570 selectOnAny with timeout vs. no timeout
Claus Gittinger <cg@exept.de>
parents: 771
diff changeset
 10093
		 * A good solution is to update the wt-timeval and redo the select.
813
1f9611434418 first stuff for locale support added
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
 10094
		 */
774
e0ee05157570 selectOnAny with timeout vs. no timeout
Claus Gittinger <cg@exept.de>
parents: 771
diff changeset
 10095
	    } while (0 /* (ret < 0) && (errno == EINTR) */ );
e0ee05157570 selectOnAny with timeout vs. no timeout
Claus Gittinger <cg@exept.de>
parents: 771
diff changeset
 10096
	}
362
claus
parents: 359
diff changeset
 10097
	__END_INTERRUPTABLE__
95
d22739a0c6e9 *** empty log message ***
claus
parents: 88
diff changeset
 10098
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
 10099
	if (ret > 0) {
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
 10100
	    for (i=0; i <= maxF; i++) {
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
 10101
		if (FD_ISSET(i, &rset)
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
 10102
		 || FD_ISSET(i, &wset)
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
 10103
		 || FD_ISSET(i, &eset)) {
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
 10104
		    RETURN ( __MKSMALLINT(i) );
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
 10105
		}
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
 10106
	    }
855
2de3c842c687 dont use SIGPIPE - it leads to trouble if its executed asynchrounously or
Claus Gittinger <cg@exept.de>
parents: 843
diff changeset
 10107
	} else {
2de3c842c687 dont use SIGPIPE - it leads to trouble if its executed asynchrounously or
Claus Gittinger <cg@exept.de>
parents: 843
diff changeset
 10108
	    if (ret < 0) {
2832
3b9900929fb3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2797
diff changeset
 10109
		if (errno == EINTR) {
3b9900929fb3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2797
diff changeset
 10110
		    errno = 0;
3b9900929fb3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2797
diff changeset
 10111
		    @global(OperatingSystem:LastErrorNumber) = nil;
3b9900929fb3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2797
diff changeset
 10112
		} else {
2281
75a360218e74 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2266
diff changeset
 10113
		    if (@global(InfoPrinting) == true) {
2496
f1b7dacdb9ab Fix SIGCHLD handling to avoid races.
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
 10114
			fprintf(stderr, "OS [info]: select errno = %d\n", errno);
2281
75a360218e74 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2266
diff changeset
 10115
		    }
2832
3b9900929fb3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2797
diff changeset
 10116
		    @global(OperatingSystem:LastErrorNumber) = __MKSMALLINT(errno);
855
2de3c842c687 dont use SIGPIPE - it leads to trouble if its executed asynchrounously or
Claus Gittinger <cg@exept.de>
parents: 843
diff changeset
 10117
		}
2832
3b9900929fb3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2797
diff changeset
 10118
	    } else {
3b9900929fb3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2797
diff changeset
 10119
		@global(OperatingSystem:LastErrorNumber) = nil;
855
2de3c842c687 dont use SIGPIPE - it leads to trouble if its executed asynchrounously or
Claus Gittinger <cg@exept.de>
parents: 843
diff changeset
 10120
	    }
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
 10121
	}
308
f04744ef7b5d *** empty log message ***
claus
parents: 300
diff changeset
 10122
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
 10123
	/*
2117
460b14a6db96 added a query for interrupts being blocked
Claus Gittinger <cg@exept.de>
parents: 2107
diff changeset
 10124
	 * return nil (means time expired or interrupted)
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
 10125
	 */
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
 10126
	RETURN ( nil );
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
 10127
    }
831
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
 10128
#endif /* not MSDOS_LIKE */
bc2dac4b75fb merged in NT changes
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
 10129
300
fe1f742a9224 *** empty log message ***
claus
parents: 275
diff changeset
 10130
fail: ;
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
 10131
%}.
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
 10132
    "
300
fe1f742a9224 *** empty log message ***
claus
parents: 275
diff changeset
 10133
     timeout argument not integer,
fe1f742a9224 *** empty log message ***
claus
parents: 275
diff changeset
 10134
     or any fd-array nonNil and not an array
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
 10135
     or not supported by OS
68
59faa75185ba *** empty log message ***
claus
parents: 63
diff changeset
 10136
    "
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
 10137
    ^ self primitiveFailed
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
 10138
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
 10139
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
 10140
setBlocking:aBoolean on:fd
1845
9d7e909b61dd some methods are compiled for space
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
 10141
    "{ Pragma: +optSpace }"
9d7e909b61dd some methods are compiled for space
Claus Gittinger <cg@exept.de>
parents: 1808
diff changeset
 10142
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
 10143
    "set/clear the blocking attribute - if set (which is the default)
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
 10144
     a read on the fileDescriptor will block until data is available.
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
 10145
     If cleared, a read operation will immediately return with a value of
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
 10146
     nil."
10
claus
parents: 5
diff changeset
 10147
claus
parents: 5
diff changeset
 10148
%{  /* NOCONTEXT */
claus
parents: 5
diff changeset
 10149
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
 10150
    int ret, flags;
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
 10151
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
 10152
#if defined(F_GETFL) && defined(F_SETFL)
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
 10153
# if defined(FNDELAY)
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
 10154
    if (__isSmallInteger(fd)) {
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
 10155
	int f = __intVal(fd);
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
 10156
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
 10157
	flags = fcntl(f, F_GETFL, 0);
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
 10158
	if (aBoolean == true) {
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
 10159
	    ret = fcntl(f, F_SETFL, flags & ~FNDELAY);
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
 10160
	} else {
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
 10161
	    ret = fcntl(f, F_SETFL, flags | FNDELAY);
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
 10162
	}
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
 10163
	if (ret >= 0) ret = flags;
1135
7fcefc747f00 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
 10164
	RETURN ( __MKSMALLINT(ret) );
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
 10165
    }
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
 10166
# endif
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
 10167
#endif
308
f04744ef7b5d *** empty log message ***
claus
parents: 300
diff changeset
 10168
%}.
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
 10169
    "
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
 10170
     fd argument not integer
185
d9be85c4cfe4 more functions
claus
parents: 123
diff changeset
 10171
    "
792
06ec639ead96 changes for NT;
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
 10172
    ^ self primitiveFailed
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
 10173
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
 10174
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
 10175
writeCheck:fd
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
 10176
    "return true, if filedescriptor can be written without blocking"
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
 10177
2972
0c50c90e6557 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2968
diff changeset
 10178
    self supportsSelect ifFalse:[
0c50c90e6557 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2968
diff changeset
 10179
	"/ mhmh - what should we do then ?
0c50c90e6557 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2968
diff changeset
 10180
	"/ For now, return true as if data was present,
0c50c90e6557 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2968
diff changeset
 10181
	"/ and let the thread fall into the write.
0c50c90e6557 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2968
diff changeset
 10182
	"/ It will then (hopefully) be desceduled there and
0c50c90e6557 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2968
diff changeset
 10183
	"/ effectively polling for output.
0c50c90e6557 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2968
diff changeset
 10184
	^ true
0c50c90e6557 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2968
diff changeset
 10185
    ].
0c50c90e6557 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2968
diff changeset
 10186
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
 10187
    (self selectOnAnyReadable:nil
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
 10188
		     writable:(Array with:fd)
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
 10189
		    exception:nil
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
 10190
		  withTimeOut:0) == fd
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
 10191
	ifTrue:[^ true].
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
 10192
    ^ false
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
 10193
! !
434
0511ecb7c818 *** empty log message ***
claus
parents: 433
diff changeset
 10194
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10195
!OperatingSystem::FileStatusInfo class methodsFor:'instance creation'!
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10196
2617
06d1b7337a33 added the alternativeName to the fileInfo (MSDOS name under NT)
Claus Gittinger <cg@exept.de>
parents: 2616
diff changeset
 10197
type:t mode:m uid:u gid:g size:s id:i accessed:aT modified:mT statusChanged:sT path:lP alternativeName:name2
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10198
    ^ self basicNew
2617
06d1b7337a33 added the alternativeName to the fileInfo (MSDOS name under NT)
Claus Gittinger <cg@exept.de>
parents: 2616
diff changeset
 10199
	type:t mode:m uid:u gid:g size:s id:i accessed:aT modified:mT statusChanged:sT path:lP alternativeName:name2
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10200
! !
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10201
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10202
!OperatingSystem::FileStatusInfo methodsFor:'accessing'!
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10203
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10204
accessed
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10205
    "return accessed"
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10206
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10207
    ^ accessed!
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10208
2617
06d1b7337a33 added the alternativeName to the fileInfo (MSDOS name under NT)
Claus Gittinger <cg@exept.de>
parents: 2616
diff changeset
 10209
alternativeName
06d1b7337a33 added the alternativeName to the fileInfo (MSDOS name under NT)
Claus Gittinger <cg@exept.de>
parents: 2616
diff changeset
 10210
    "return the files other name (DOS name on windows).
06d1b7337a33 added the alternativeName to the fileInfo (MSDOS name under NT)
Claus Gittinger <cg@exept.de>
parents: 2616
diff changeset
 10211
     Nil if there is no other name"
06d1b7337a33 added the alternativeName to the fileInfo (MSDOS name under NT)
Claus Gittinger <cg@exept.de>
parents: 2616
diff changeset
 10212
06d1b7337a33 added the alternativeName to the fileInfo (MSDOS name under NT)
Claus Gittinger <cg@exept.de>
parents: 2616
diff changeset
 10213
    ^ alternativeName
06d1b7337a33 added the alternativeName to the fileInfo (MSDOS name under NT)
Claus Gittinger <cg@exept.de>
parents: 2616
diff changeset
 10214
!
06d1b7337a33 added the alternativeName to the fileInfo (MSDOS name under NT)
Claus Gittinger <cg@exept.de>
parents: 2616
diff changeset
 10215
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10216
fixedHeaderSize
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10217
    "return the fixedHeaderSize (VMS only; nil everywhere else)"
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10218
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10219
    ^ fixedHeaderSize
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10220
!
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10221
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10222
gid
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10223
    "return gid"
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10224
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10225
    ^ gid!
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10226
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10227
id
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10228
    "return id"
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10229
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10230
    ^ id!
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10231
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10232
mode
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10233
    "return mode"
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10234
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10235
    ^ mode!
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10236
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10237
modified
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10238
    "return modified"
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10239
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10240
    ^ modified!
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10241
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10242
path
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10243
    "for symbolic links only: return the path where the symbolic link points to"
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10244
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10245
    ^ path
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10246
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10247
!
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10248
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10249
recordAttributes
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10250
    "return the recordAttributes (VMS only; nil everywhere else)"
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10251
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10252
    ^ recordAttributes
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10253
!
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10254
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10255
recordFormat
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10256
    "return the recordFormat (VMS only; nil everywhere else)"
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10257
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10258
    ^ recordFormat
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10259
!
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10260
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10261
recordFormatNumeric
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10262
    "return the recordFormat as numeric (VMS only; nil everywhere else)"
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10263
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10264
    ^ recordFormatNumeric
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10265
!
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10266
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10267
recordSize
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10268
    "return the recordSize (VMS only; nil everywhere else)"
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10269
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10270
    ^ recordSize
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10271
!
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10272
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10273
size
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10274
    "return size"
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10275
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10276
    ^ size!
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10277
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10278
statusChanged
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10279
    "return statusChanged"
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10280
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10281
    ^ statusChanged!
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10282
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10283
type
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10284
    "return type"
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10285
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10286
    ^ type!
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10287
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10288
uid
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10289
    "return uid"
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10290
2617
06d1b7337a33 added the alternativeName to the fileInfo (MSDOS name under NT)
Claus Gittinger <cg@exept.de>
parents: 2616
diff changeset
 10291
    ^ uid
06d1b7337a33 added the alternativeName to the fileInfo (MSDOS name under NT)
Claus Gittinger <cg@exept.de>
parents: 2616
diff changeset
 10292
! !
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10293
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10294
!OperatingSystem::FileStatusInfo methodsFor:'backward compatibility'!
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10295
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10296
at:key
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10297
    "backward compatibility access: in previous releases, IdentityDictionaries
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10298
     were used to hold my information. Allow access via key messages.
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10299
     This method will vanish - use the proper access protocol."
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10300
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10301
    ^ self perform:key
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10302
! !
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10303
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10304
!OperatingSystem::FileStatusInfo methodsFor:'private accessing'!
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10305
2930
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10306
recordFormat:rf recordFormatNumeric:nrf recordAttributes:ra fixedHeaderSize:hs recordSize:rs
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10307
    recordFormat := rf.
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10308
    recordFormatNumeric := nrf.
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10309
    recordAttributes := ra.
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10310
    fixedHeaderSize := hs.
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10311
    recordSize := rs
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10312
!
a8999d16b8f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
 10313
2617
06d1b7337a33 added the alternativeName to the fileInfo (MSDOS name under NT)
Claus Gittinger <cg@exept.de>
parents: 2616
diff changeset
 10314
type:t mode:m uid:u gid:g size:s id:i accessed:aT modified:mT statusChanged:sT path:lP alternativeName:name2
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10315
    type := t.
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10316
    mode := m.
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10317
    uid := u.
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10318
    gid := g.
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10319
    size := s.
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10320
    id := i.
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10321
    accessed := aT.
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10322
    modified := mT.
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10323
    statusChanged := sT.
2617
06d1b7337a33 added the alternativeName to the fileInfo (MSDOS name under NT)
Claus Gittinger <cg@exept.de>
parents: 2616
diff changeset
 10324
    path := lP.
06d1b7337a33 added the alternativeName to the fileInfo (MSDOS name under NT)
Claus Gittinger <cg@exept.de>
parents: 2616
diff changeset
 10325
    alternativeName := name2.
2615
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10326
! !
85d8b7ee95f1 more queries; changes for winNT
Claus Gittinger <cg@exept.de>
parents: 2613
diff changeset
 10327
1966
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10328
!OperatingSystem::OSProcessStatus class methodsFor:'documentation'!
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10329
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10330
documentation
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10331
"
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10332
    This is an auxillary class, that holds information about status changes of
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10333
    operating system processes (these are no smalltalk processes!!).
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10334
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10335
    [Instance variables:]
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10336
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10337
	pid     <Integer>       OS-Process identifier
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10338
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10339
	status  <Symbol>        either #exit #signal #stop #continue
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10340
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10341
	code    <Integer>       either exitcode or signalnumber
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10342
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10343
	core    <Boolean>       true if core has been dumped
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10344
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10345
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10346
    [author:]
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10347
	Stefan Vogel
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10348
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10349
    [see also:]
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10350
	OperatingSystem
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10351
"
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10352
! !
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10353
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10354
!OperatingSystem::OSProcessStatus class methodsFor:'instance creation'!
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10355
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10356
pid:pid status:status code:code core:core
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10357
    "private interface for OperatingSystem"
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10358
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10359
    ^ self new pid:pid status:status code:code core:core
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10360
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10361
    "Created: 28.12.1995 / 14:16:14 / stefan"
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10362
    "Modified: 30.4.1996 / 18:25:00 / cg"
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10363
!
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10364
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10365
processCreationFailure
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10366
    "private interface for OperatingSystem"
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10367
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10368
    ^ self new pid:-1 status:#failure code:-1 core:false
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10369
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10370
    "Created: 28.12.1995 / 14:35:29 / stefan"
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10371
    "Modified: 30.4.1996 / 18:25:05 / cg"
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10372
! !
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10373
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10374
!OperatingSystem::OSProcessStatus methodsFor:'accessing'!
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10375
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10376
code
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10377
    "return the exitcode / signalNumber"
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10378
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10379
    ^ code
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10380
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10381
    "Created: 28.12.1995 / 14:05:07 / stefan"
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10382
    "Modified: 30.4.1996 / 18:26:23 / cg"
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10383
!
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10384
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10385
core
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10386
    "return true if core has been dumped, false otherwise"
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10387
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10388
    ^ core == true
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10389
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10390
    "Modified: 28.12.1995 / 14:14:38 / stefan"
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10391
!
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10392
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10393
pid
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10394
    "return the pid"
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10395
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10396
    ^ pid
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10397
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10398
    "Created: 28.12.1995 / 14:05:07 / stefan"
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10399
    "Modified: 30.4.1996 / 18:26:30 / cg"
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10400
!
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10401
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10402
status
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10403
    "return status as a Symbol;
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10404
     one of #exit #signal #stop #continue"
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10405
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10406
    ^ status
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10407
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10408
    "Created: 28.12.1995 / 14:05:07 / stefan"
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10409
    "Modified: 30.4.1996 / 18:26:54 / cg"
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10410
! !
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10411
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10412
!OperatingSystem::OSProcessStatus methodsFor:'initialization'!
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10413
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10414
pid:newPid status:newStatus code:newCode core:newCore
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10415
    pid := newPid.
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10416
    status := newStatus.
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10417
    code := newCode.
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10418
    core := newCore.
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10419
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10420
    "Created: 28.12.1995 / 14:18:22 / stefan"
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10421
! !
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10422
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10423
!OperatingSystem::OSProcessStatus methodsFor:'private-OS interface'!
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10424
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10425
code:something
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10426
    "set the exitCode"
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10427
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10428
    code := something.
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10429
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10430
    "Created: 28.12.1995 / 14:05:07 / stefan"
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10431
    "Modified: 30.4.1996 / 18:25:18 / cg"
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10432
!
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10433
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10434
core:something
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10435
    "set core"
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10436
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10437
    core := something.
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10438
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10439
    "Created: 28.12.1995 / 14:05:07 / stefan"
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10440
!
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10441
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10442
pid:something
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10443
    "set pid"
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10444
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10445
    pid := something.
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10446
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10447
    "Created: 28.12.1995 / 14:05:07 / stefan"
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10448
!
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10449
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10450
status:something
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10451
    "set status"
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10452
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10453
    status := something.
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10454
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10455
    "Created: 28.12.1995 / 14:05:07 / stefan"
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10456
! !
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10457
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10458
!OperatingSystem::OSProcessStatus methodsFor:'queries'!
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10459
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10460
couldNotExecute
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10461
    "return true when a command could not be executed"
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10462
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10463
    ^ status == #exit and:[code = 127].
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10464
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10465
    "Created: 28.12.1995 / 15:43:17 / stefan"
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10466
    "Modified: 30.4.1996 / 18:27:03 / cg"
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10467
!
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10468
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10469
stillAlive
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10470
    "true if process is still alive"
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10471
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10472
    ^ status == #stop or:[status == #continue]
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10473
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10474
    "Created: 28.12.1995 / 14:27:26 / stefan"
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10475
!
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10476
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10477
success
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10478
    "true if process terminated successfully"
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10479
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10480
    ^ status == #exit and:[code = 0]
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10481
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10482
    "Created: 28.12.1995 / 14:13:05 / stefan"
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10483
    "Modified: 28.12.1995 / 14:13:41 / stefan"
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10484
! !
8b14cce1442b Make OSProcesStatus private to OperatingSystem.
Stefan Vogel <sv@exept.de>
parents: 1885
diff changeset
 10485
1799
0a2c5890f4f3 handle 'foo///' in directoryName
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
 10486
!OperatingSystem class methodsFor:'documentation'!
630
b785d23d7c5b version at the end
Claus Gittinger <cg@exept.de>
parents: 616
diff changeset
 10487
b785d23d7c5b version at the end
Claus Gittinger <cg@exept.de>
parents: 616
diff changeset
 10488
version
2995
07f6017880ec win32 changes
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
 10489
    ^ '$Header: /cvs/stx/stx/libbasic/Attic/Unix.st,v 1.264 1997-10-04 16:29:50 cg Exp $'
630
b785d23d7c5b version at the end
Claus Gittinger <cg@exept.de>
parents: 616
diff changeset
 10490
! !
616
8226d2eb1e3d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
 10491
OperatingSystem initialize!