This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
IO::getline(): use CALLRUNOPS
[perl5.git] / unixish.h
1 /*    unixish.h
2  *
3  *    Copyright (C) 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002,
4  *    2003, 2006, 2007, by Larry Wall and others
5  *
6  *    You may distribute under the terms of either the GNU General Public
7  *    License or the Artistic License, as specified in the README file.
8  *
9  */
10
11 /*
12  * The following symbols are defined if your operating system supports
13  * functions by that name.  All Unixes I know of support them, thus they
14  * are not checked by the configuration script, but are directly defined
15  * here.
16  */
17
18 /* HAS_IOCTL:
19  *      This symbol, if defined, indicates that the ioctl() routine is
20  *      available to set I/O characteristics
21  */
22 #define HAS_IOCTL               /**/
23  
24 /* HAS_UTIME:
25  *      This symbol, if defined, indicates that the routine utime() is
26  *      available to update the access and modification times of files.
27  */
28 #define HAS_UTIME               /**/
29
30 /* HAS_GROUP
31  *      This symbol, if defined, indicates that the getgrnam() and
32  *      getgrgid() routines are available to get group entries.
33  *      The getgrent() has a separate definition, HAS_GETGRENT.
34  */
35 #define HAS_GROUP               /**/
36
37 /* HAS_PASSWD
38  *      This symbol, if defined, indicates that the getpwnam() and
39  *      getpwuid() routines are available to get password entries.
40  *      The getpwent() has a separate definition, HAS_GETPWENT.
41  */
42 #define HAS_PASSWD              /**/
43
44 #define HAS_KILL
45 #define HAS_WAIT
46
47 /* USEMYBINMODE
48  *      This symbol, if defined, indicates that the program should
49  *      use the routine my_binmode(FILE *fp, char iotype) to insure
50  *      that a file is in "binary" mode -- that is, that no translation
51  *      of bytes occurs on read or write operations.
52  */
53 #undef USEMYBINMODE
54
55 /* Stat_t:
56  *      This symbol holds the type used to declare buffers for information
57  *      returned by stat().  It's usually just struct stat.  It may be necessary
58  *      to include <sys/stat.h> and <sys/types.h> to get any typedef'ed
59  *      information.
60  */
61 #define Stat_t struct stat
62
63 /* USE_STAT_RDEV:
64  *      This symbol is defined if this system has a stat structure declaring
65  *      st_rdev
66  */
67 #define USE_STAT_RDEV   /**/
68
69 /* ACME_MESS:
70  *      This symbol, if defined, indicates that error messages should be 
71  *      should be generated in a format that allows the use of the Acme
72  *      GUI/editor's autofind feature.
73  */
74 #undef ACME_MESS        /**/
75
76 /* UNLINK_ALL_VERSIONS:
77  *      This symbol, if defined, indicates that the program should arrange
78  *      to remove all versions of a file if unlink() is called.  This is
79  *      probably only relevant for VMS.
80  */
81 /* #define UNLINK_ALL_VERSIONS          / **/
82
83 /* VMS:
84  *      This symbol, if defined, indicates that the program is running under
85  *      VMS.  It is currently automatically set by cpps running under VMS,
86  *      and is included here for completeness only.
87  */
88 /* #define VMS          / **/
89
90 /* ALTERNATE_SHEBANG:
91  *      This symbol, if defined, contains a "magic" string which may be used
92  *      as the first line of a Perl program designed to be executed directly
93  *      by name, instead of the standard Unix #!.  If ALTERNATE_SHEBANG
94  *      begins with a character other then #, then Perl will only treat
95  *      it as a command line if it finds the string "perl" in the first
96  *      word; otherwise it's treated as the first line of code in the script.
97  *      (IOW, Perl won't hand off to another interpreter via an alternate
98  *      shebang sequence that might be legal Perl code.)
99  */
100 /* #define ALTERNATE_SHEBANG "#!" / **/
101
102 # include <signal.h>
103
104 #ifndef SIGABRT
105 #    define SIGABRT SIGILL
106 #endif
107 #ifndef SIGILL
108 #    define SIGILL 6         /* blech */
109 #endif
110 #define ABORT() kill(PerlProc_getpid(),SIGABRT);
111
112 /*
113  * fwrite1() should be a routine with the same calling sequence as fwrite(),
114  * but which outputs all of the bytes requested as a single stream (unlike
115  * fwrite() itself, which on some systems outputs several distinct records
116  * if the number_of_items parameter is >1).
117  */
118 #define fwrite1 fwrite
119
120 #define Stat(fname,bufptr) stat((fname),(bufptr))
121
122 #ifdef __amigaos4__
123 int afstat(int fd, struct stat *statb);
124 #  define Fstat(fd,bufptr) afstat((fd),(bufptr))
125 #endif
126
127 #ifndef Fstat
128 #  define Fstat(fd,bufptr)   fstat((fd),(bufptr))
129 #endif
130
131 #define Fflush(fp)         fflush(fp)
132 #define Mkdir(path,mode)   mkdir((path),(mode))
133
134 #if defined(__amigaos4__)
135 #  define PLATFORM_SYS_TERM_  amigaos4_dispose_fork_array()
136 #  define PLATFORM_SYS_INIT_ STMT_START {                       \
137                                 amigaos4_init_fork_array();     \
138                                 amigaos4_init_environ_sema();   \
139                              } STMT_END
140 #else 
141 #  define PLATFORM_SYS_TERM_  NOOP
142 #  define PLATFORM_SYS_INIT_  NOOP
143 #endif
144
145 #ifndef PERL_SYS_INIT_BODY
146 #define PERL_SYS_INIT_BODY(c,v)                                 \
147         MALLOC_CHECK_TAINT2(*c,*v) PERL_FPU_INIT; PERLIO_INIT;  \
148         MALLOC_INIT; PLATFORM_SYS_INIT_;
149 #endif
150
151 /* Generally add things last-in first-terminated.  IO and memory terminations
152  * need to be generally last
153  *
154  * BEWARE that using PerlIO in these will be using freed memory, so may appear
155  * to work, but must NOT be retained in production code. */
156 #ifndef PERL_SYS_TERM_BODY
157 #  define PERL_SYS_TERM_BODY()                                          \
158                     ENV_TERM; USER_PROP_MUTEX_TERM; LOCALE_TERM;        \
159                     HINTS_REFCNT_TERM; KEYWORD_PLUGIN_MUTEX_TERM;       \
160                     OP_CHECK_MUTEX_TERM; OP_REFCNT_TERM;                \
161                     PERLIO_TERM; MALLOC_TERM;                           \
162                     PLATFORM_SYS_TERM_;
163 #endif
164
165 #define BIT_BUCKET "/dev/null"
166
167 #define dXSUB_SYS dNOOP
168
169 #ifndef NO_ENVIRON_ARRAY
170 #define USE_ENVIRON_ARRAY
171 #endif
172
173 /*
174  * ex: set ts=8 sts=4 sw=4 et:
175  */