1 /* -*-C-*-
2 
3 Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
4     1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
5     2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Massachusetts
6     Institute of Technology
7 
8 This file is part of MIT/GNU Scheme.
9 
10 MIT/GNU Scheme is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or (at
13 your option) any later version.
14 
15 MIT/GNU Scheme is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 General Public License for more details.
19 
20 You should have received a copy of the GNU General Public License
21 along with MIT/GNU Scheme; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
23 USA.
24 
25 */
26 
27 /* OS system calls and errors.  */
28 
29 #ifndef SCM_SYSCALL_H
30 #define SCM_SYSCALL_H 1
31 
32 #include "config.h"
33 
34 #ifdef __OS2__
35 #  define DEFINE_OS2_SYSCALLS
36 #  include "os2api.h"
37 #  undef DEFINE_OS2_SYSCALLS
38 #else
39 #  ifdef __WIN32__
40 #    define DEFINE_WIN32_SYSCALLS
41 #    include "ntapi.h"
42 #    undef DEFINE_WIN32_SYSCALLS
43 #  else
44 
45 /* Unix case, inline for historical reasons.  Must match "uxtop.c".  */
46 
47 enum syscall_names
48 {
49   syscall_accept,
50   syscall_bind,
51   syscall_chdir,
52   syscall_chmod,
53   syscall_clock_gettime,
54   syscall_close,
55   syscall_connect,
56   syscall_fcntl_GETFL,
57   syscall_fcntl_FULLFSYNC,
58   syscall_fcntl_SETFL,
59   syscall_fdatasync,
60   syscall_fork,
61   syscall_fstat,
62   syscall_fstatfs,
63   syscall_fsync,
64   syscall_fsync_range,
65   syscall_ftruncate,
66   syscall_getcwd,
67   syscall_gethostname,
68   syscall_gettimeofday,
69   syscall_gmtime,
70   syscall_ioctl_TIOCGPGRP,
71   syscall_ioctl_TIOCSIGSEND,
72   syscall_kill,
73   syscall_link,
74   syscall_listen,
75   syscall_localtime,
76   syscall_lseek,
77   syscall_lstat,
78   syscall_malloc,
79   syscall_mkdir,
80   syscall_mktime,
81   syscall_ntp_adjtime,
82   syscall_ntp_gettime,
83   syscall_open,
84   syscall_opendir,
85   syscall_pause,
86   syscall_pipe,
87   syscall_read,
88   syscall_readlink,
89   syscall_realloc,
90   syscall_rename,
91   syscall_rmdir,
92   syscall_select,
93   syscall_setitimer,
94   syscall_setpgid,
95   syscall_setsockopt,
96   syscall_shutdown,
97   syscall_sighold,
98   syscall_sigprocmask,
99   syscall_sigsuspend,
100   syscall_sleep,
101   syscall_socket,
102   syscall_stat,
103   syscall_statfs,
104   syscall_symlink,
105   syscall_sync_file_range,
106   syscall_tcdrain,
107   syscall_tcflush,
108   syscall_tcgetpgrp,
109   syscall_tcsetpgrp,
110   syscall_terminal_get_state,
111   syscall_terminal_set_state,
112   syscall_time,
113   syscall_times,
114   syscall_unlink,
115   syscall_utime,
116   syscall_vfork,
117   syscall_write,
118 };
119 
120 enum syserr_names
121 {
122   syserr_unknown,
123   syserr_address_family_not_supported,
124   syserr_address_in_use,
125   syserr_address_not_available,
126   syserr_arg_list_too_long,
127   syserr_bad_address,
128   syserr_bad_file_descriptor,
129   syserr_broken_pipe,
130   syserr_connection_refused,
131   syserr_connection_reset,
132   syserr_directory_not_empty,
133   syserr_domain_error,
134   syserr_exec_format_error,
135   syserr_file_exists,
136   syserr_file_too_large,
137   syserr_filename_too_long,
138   syserr_function_not_implemented,
139   syserr_host_is_unreachable,
140   syserr_improper_link,
141   syserr_inappropriate_io_control_operation,
142   syserr_interrupted_function_call,
143   syserr_invalid_argument,
144   syserr_invalid_seek,
145   syserr_io_error,
146   syserr_is_a_directory,
147   syserr_no_child_processes,
148   syserr_no_locks_available,
149   syserr_no_space_left_on_device,
150   syserr_no_such_device,
151   syserr_no_such_device_or_address,
152   syserr_no_such_file_or_directory,
153   syserr_no_such_process,
154   syserr_not_a_directory,
155   syserr_not_enough_space,
156   syserr_operation_not_permitted,
157   syserr_permission_denied,
158   syserr_read_only_file_system,
159   syserr_resource_busy,
160   syserr_resource_deadlock_avoided,
161   syserr_resource_temporarily_unavailable,
162   syserr_result_too_large,
163   syserr_too_many_links,
164   syserr_too_many_open_files,
165   syserr_too_many_open_files_in_system
166 };
167 
168 #  endif /* not __WIN32__ */
169 #endif /* not __OS2__ */
170 
171 extern void error_in_system_call (enum syserr_names, enum syscall_names)
172      NORETURN;
173 extern void error_system_call (int, enum syscall_names) NORETURN;
174 extern enum syserr_names OS_error_code_to_syserr (int);
175 
176 #endif /* SCM_SYSCALL_H */
177