00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef CONEXUSEXCEPT_OPEN_H
00020 #define CONEXUSEXCEPT_OPEN_H
00021
00022 #include <conexus/except.h>
00023
00024 namespace Conexus
00025 {
00026
00032 class open_exception: public conexus_exception
00033 {
00034 public:
00035 open_exception ( int e = 0 ) : conexus_exception ( ::strerror ( e ), e, "open" )
00036 { }
00037 open_exception ( const std::string s, int e = 0 ) : conexus_exception ( ::strerror ( e ), e, "open" )
00038 { }
00039 };
00040
00041 namespace exception
00042 {
00043
00044
00045 namespace open
00046 {
00047
00054 class protocol_not_supported: public open_exception
00055 {
00056 public:
00057 protocol_not_supported() : open_exception ( "The protocol type or the specified protocol is not supported within this domain.", EPROTONOSUPPORT )
00058 { }
00059 };
00060
00066 class af_not_supported: public open_exception
00067 {
00068 public:
00069 af_not_supported() : open_exception ( "The implementation does not support the specified address family.", EAFNOSUPPORT )
00070 { }
00071 };
00072
00078 class system_file: public open_exception
00079 {
00080 public:
00081 system_file() : open_exception ( "The system limit on the total number of open files has been reached.", ENFILE )
00082 { }
00083 };
00084
00090 class process_file: public open_exception
00091 {
00092 public:
00093 process_file() : open_exception ( "The process already has the maximum number of files open.", EMFILE )
00094 { }
00095 };
00096
00102 class access: public open_exception
00103 {
00104 public:
00105 access() : open_exception ( "Permission to access the file or create a socket of the specified type and/or protocol is denied.", EACCES )
00106 { }
00107 };
00108
00115 class no_memory: public open_exception
00116 {
00117 public:
00118 no_memory() : open_exception ( "Insufficient memory is available. The socket cannot be created until sufficient resources are freed.", ENOBUFS )
00119 { }
00120 };
00121
00127 class invalid_protocol: public open_exception
00128 {
00129 public:
00130 invalid_protocol() : open_exception ( "Unknown protocol, or protocol family not available.", EINVAL )
00131 { }
00132 };
00133
00139 class exists: public open_exception
00140 {
00141 public:
00142 exists() : open_exception ( "File already exists and O_CREAT and O_EXCL were used.", EEXIST )
00143 { }
00144 };
00145
00151 class fault: public open_exception
00152 {
00153 public:
00154 fault() : open_exception ( "File path points outside your accessible address space.", EFAULT )
00155 { }
00156 };
00157
00164 class is_directory: public open_exception
00165 {
00166 public:
00167 is_directory() : open_exception ( "Pathname refers to a directory and the access requested involved writing (that is, O_WRONLY or O_RDWR is set).", EISDIR )
00168 { }
00169 };
00170
00177 class loop: public open_exception
00178 {
00179 public:
00180 loop() : open_exception ( "Too many symbolic links were encountered in resolving pathname, or O_NOFOLLOW was specified but pathname was a symbolic link.", ELOOP )
00181 { }
00182 };
00183
00189 class name_too_long: public open_exception
00190 {
00191 public:
00192 name_too_long() : open_exception ( "Pathname was too long.", ENAMETOOLONG )
00193 { }
00194 };
00195
00203 class no_device: public open_exception
00204 {
00205 public:
00206 no_device() : open_exception ( "pathname refers to a device special file and no corresponding device exists.", ENODEV )
00207 { }
00208 };
00209
00217 class no_exist: public open_exception
00218 {
00219 public:
00220 no_exist() : open_exception ( "O_CREAT is not set and the named file does not exist. Or, a directory component in pathname does not exist or is a dangling symbolic link.", ENOENT )
00221 { }
00222 };
00223
00230 class no_space: public open_exception
00231 {
00232 public:
00233 no_space() : open_exception ( "pathname was to be created but the device containing pathname has no room for the new file.", ENOSPC )
00234 { }
00235 };
00236
00244 class not_directory: public open_exception
00245 {
00246 public:
00247 not_directory() : open_exception ( "A component used as a directory in pathname is not, in fact, a directory, or O_DIRECTORY was specified and pathname was not a directory.", ENOTDIR )
00248 { }
00249 };
00250
00258 class no_io: public open_exception
00259 {
00260 public:
00261 no_io() : open_exception ( "O_NONBLOCK | O_WRONLY is set, the named file is a FIFO and no process has the file open for reading. Or, the file is a device special file and no corresponding device exists.", ENXIO )
00262 { }
00263 };
00264
00271 class file_too_large: public open_exception
00272 {
00273 public:
00274 file_too_large() : open_exception ( "pathname refers to a regular file, too large to be opened; see O_LARGEFILE above.", EOVERFLOW )
00275 { }
00276 };
00277
00285 class no_permission: public open_exception
00286 {
00287 public:
00288 no_permission() : open_exception ( "The O_NOATIME flag was specified, but the effective user ID of the caller did not match the owner of the file and the caller was not privileged (CAP_FOWNER).", EPERM )
00289 { }
00290 };
00291
00298 class read_only: public open_exception
00299 {
00300 public:
00301 read_only() : open_exception ( "pathname refers to a file on a read-only filesystem and write access was requested.", EROFS )
00302 { }
00303 };
00304
00311 class executable_busy: public open_exception
00312 {
00313 public:
00314 executable_busy() : open_exception ( "pathname refers to an executable image which is currently being executed and write access was requested.", ETXTBSY )
00315 { }
00316 };
00317
00324 class would_block: public open_exception
00325 {
00326 public:
00327 would_block() : open_exception ( "The O_NONBLOCK flag was specified, and an incompatible lease was held on the file.", EWOULDBLOCK )
00328 { }
00329 };
00330
00336 class no_device_set: public open_exception
00337 {
00338 public:
00339 no_device_set() : open_exception ( "open requested and device not available or not set.", -1 )
00340 { }
00341 };
00342
00348 class no_filename: public open_exception
00349 {
00350 public:
00351 no_filename() : open_exception ( "open requested on file, but filename not set or file not found.", -1 )
00352 { }
00353 };
00354
00360 class invalid_file_mode: public open_exception
00361 {
00362 public:
00363 invalid_file_mode() : open_exception ( "open requested on file, but the file's mode is invalid. It should at least be either Conexus::FILE_READ or Conexus::FILE_WRITE.", -1 )
00364 { }
00365 };
00366
00372 class no_rd_wr_rdwr: public open_exception
00373 {
00374 public:
00375 no_rd_wr_rdwr() : open_exception ( "open requires read, write or read/write mode, but none was given", -1 )
00376 { }
00377 };
00378
00384 class set_nonblock_failed: public open_exception
00385 {
00386 public:
00387 set_nonblock_failed() : open_exception ( "File or socket requires non-blocking I/O and setting non-block mode failed", -1 )
00388 { }
00389 };
00390
00391 }
00392
00393
00394 }
00395 }
00396
00397 #endif // CONEXUSCREATE_ERROR_H