URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
Compare Revisions
- This comparison shows the changes necessary to convert path
/openrisc/trunk/rtos/ecos-2.0/packages/error/v2_0
- from Rev 27 to Rev 174
- ↔ Reverse comparison
Rev 27 → Rev 174
/cdl/error.cdl
0,0 → 1,157
# ==================================================================== |
# |
# error.cdl |
# |
# Error package configuration data |
# |
# ==================================================================== |
#####ECOSGPLCOPYRIGHTBEGIN#### |
## ------------------------------------------- |
## This file is part of eCos, the Embedded Configurable Operating System. |
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
## |
## eCos is free software; you can redistribute it and/or modify it under |
## the terms of the GNU General Public License as published by the Free |
## Software Foundation; either version 2 or (at your option) any later version. |
## |
## eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
## WARRANTY; without even the implied warranty of MERCHANTABILITY or |
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
## for more details. |
## |
## You should have received a copy of the GNU General Public License along |
## with eCos; if not, write to the Free Software Foundation, Inc., |
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
## |
## As a special exception, if other files instantiate templates or use macros |
## or inline functions from this file, or you compile this file and link it |
## with other works to produce a work based on this file, this file does not |
## by itself cause the resulting work to be covered by the GNU General Public |
## License. However the source code for this file must still be made available |
## in accordance with section (3) of the GNU General Public License. |
## |
## This exception does not invalidate any other reasons why a work based on |
## this file might be covered by the GNU General Public License. |
## |
## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
## at http://sources.redhat.com/ecos/ecos-license/ |
## ------------------------------------------- |
#####ECOSGPLCOPYRIGHTEND#### |
# ==================================================================== |
######DESCRIPTIONBEGIN#### |
# |
# Author(s): bartv,jlarmour |
# Original data: jlarmour |
# Contributors: |
# Date: 2000-04-14 |
# |
#####DESCRIPTIONEND#### |
# |
# ==================================================================== |
|
cdl_package CYGPKG_ERROR { |
display "Common error code support" |
compile strerror.cxx errno.cxx |
include_dir cyg/error |
implements CYGINT_ISO_ERRNO_CODES |
requires { CYGBLD_ISO_ERRNO_CODES_HEADER == "<cyg/error/codes.h>" } |
description " |
This package contains the common list of error and |
status codes. It is held centrally to allow |
packages to interchange error codes and status |
codes in a common way, rather than each package |
having its own conventions for error/status |
reporting. The error codes are modelled on the |
POSIX style naming e.g. EINVAL etc. This package |
also provides the standard strerror() function to |
convert error codes to textual representation, as |
well as an implementation of the errno idiom." |
|
# ==================================================================== |
# ERRNO OPTIONS |
|
cdl_component CYGPKG_ERROR_ERRNO { |
display "errno variable" |
flavor bool |
implements CYGINT_ISO_ERRNO |
requires { CYGBLD_ISO_ERRNO_HEADER == "<cyg/error/errno.h>" } |
default_value 1 |
description " |
This package controls the behaviour of the |
errno variable (or more strictly, expression) |
from <errno.h>." |
|
cdl_option CYGSEM_ERROR_PER_THREAD_ERRNO { |
display "Per-thread errno" |
requires CYGVAR_KERNEL_THREADS_DATA |
default_value 1 |
description " |
This option controls whether the standard error |
code reporting variable errno is a per-thread |
variable, rather than global." |
} |
|
cdl_option CYGNUM_ERROR_ERRNO_TRACE_LEVEL { |
display "Tracing level" |
flavor data |
legal_values 0 to 1 |
default_value 0 |
description " |
Trace verbosity level for debugging the errno |
retrieval mechanism in errno.cxx. Increase this |
value to get additional trace output." |
} |
} |
|
# ==================================================================== |
# STRERROR OPTIONS |
|
cdl_option CYGPKG_ERROR_STRERROR { |
display "strerror function" |
flavor bool |
implements CYGINT_ISO_STRERROR |
requires { CYGBLD_ISO_STRERROR_HEADER == "<cyg/error/strerror.h>" } |
default_value 1 |
description " |
This package controls the presence and behaviour of the |
strerror() function from <string.h>" |
} |
|
# ==================================================================== |
# BUILD OPTIONS |
cdl_component CYGPKG_ERROR_OPTIONS { |
display "Error package build options" |
flavor none |
no_define |
description " |
Package specific build options including control over |
compiler flags used only in building this package, |
and details of which tests are built." |
|
|
cdl_option CYGPKG_ERROR_CFLAGS_ADD { |
display "Additional compiler flags" |
flavor data |
no_define |
default_value { "" } |
description " |
This option modifies the set of compiler flags for |
building the error package. These flags are used in addition |
to the set of global flags." |
} |
|
cdl_option CYGPKG_ERROR_CFLAGS_REMOVE { |
display "Suppressed compiler flags" |
flavor data |
no_define |
default_value { "" } |
description " |
This option modifies the set of compiler flags for |
building the error package. These flags are removed from |
the set of global flags if present." |
} |
} |
} |
|
# ==================================================================== |
# EOF error.cdl |
/include/codes.h
0,0 → 1,184
#ifndef CYGONCE_ERROR_CODES_H |
#define CYGONCE_ERROR_CODES_H |
/*=========================================================================== |
// |
// codes.h |
// |
// Common error code definitions |
// |
//=========================================================================== |
//####ECOSGPLCOPYRIGHTBEGIN#### |
// ------------------------------------------- |
// This file is part of eCos, the Embedded Configurable Operating System. |
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
// |
// eCos is free software; you can redistribute it and/or modify it under |
// the terms of the GNU General Public License as published by the Free |
// Software Foundation; either version 2 or (at your option) any later version. |
// |
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
// WARRANTY; without even the implied warranty of MERCHANTABILITY or |
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
// for more details. |
// |
// You should have received a copy of the GNU General Public License along |
// with eCos; if not, write to the Free Software Foundation, Inc., |
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
// |
// As a special exception, if other files instantiate templates or use macros |
// or inline functions from this file, or you compile this file and link it |
// with other works to produce a work based on this file, this file does not |
// by itself cause the resulting work to be covered by the GNU General Public |
// License. However the source code for this file must still be made available |
// in accordance with section (3) of the GNU General Public License. |
// |
// This exception does not invalidate any other reasons why a work based on |
// this file might be covered by the GNU General Public License. |
// |
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
// at http://sources.redhat.com/ecos/ecos-license/ |
// ------------------------------------------- |
//####ECOSGPLCOPYRIGHTEND#### |
//=========================================================================== |
//#####DESCRIPTIONBEGIN#### |
// |
// Author(s): jlarmour |
// Contributors: jlarmour |
// Date: 2000-04-14 |
// Purpose: To provide a common set of error codes |
// Description: This provides a common set of error codes that all |
// packages can agree on. It doesn't preclude them defining |
// their own error return system, but this is a preferable |
// system to use to help error support be as general as |
// possible. |
// |
// We try and conform to the ANSI/POSIX error code format, |
// namely starting with the character 'E' |
// |
// Usage: #include <cyg/error/codes.h> |
// |
// Example: |
// |
// err=myfun(); |
// if (err != ENOERR) |
// { |
// str=strerror(err); |
// printf("myfun returned error: %s\n", str); |
// } |
// else .... |
// |
//####DESCRIPTIONEND#### |
// |
//=========================================================================*/ |
|
/* CONFIGURATION */ |
|
#include <pkgconf/error.h> // Configuration header |
|
#ifdef __cplusplus |
extern "C" { |
#endif |
|
/* TYPE DEFINITIONS */ |
|
/* A type for error codes which may be useful to explain the purpose of |
* a variable or return code. It shows that it contains an error code |
* of the type defined below */ |
|
typedef int Cyg_ErrNo; |
|
|
/* CONSTANT DEFINITIONS */ |
|
/* If adding to this list, you must also update strerror() with its text |
* If there is a common error of the same purpose on Unix, try and use its |
* name and number. If not, use one above 200 to prevent future conflicts |
* |
* Do not use negative numbers, so that functions can return positive on |
* success and -ESOMETHING on error, and it all works consistently. |
*/ |
|
#define ENOERR 0 /* No error */ |
#define EPERM 1 /* Not permitted */ |
#define ENOENT 2 /* No such entity */ |
#define ESRCH 3 /* No such process */ |
#define EINTR 4 /* Operation interrupted */ |
#define EIO 5 /* I/O error */ |
#define EBADF 9 /* Bad file handle */ |
#define EAGAIN 11 /* Try again later */ |
#define EWOULDBLOCK EAGAIN |
#define ENOMEM 12 /* Out of memory */ |
#define EBUSY 16 /* Resource busy */ |
#define EXDEV 18 /* Cross-device link */ |
#define ENODEV 19 /* No such device */ |
#define ENOTDIR 20 /* Not a directory */ |
#define EISDIR 21 /* Is a directory */ |
#define EINVAL 22 /* Invalid argument */ |
#define ENFILE 23 /* Too many open files in system */ |
#define EMFILE 24 /* Too many open files */ |
#define EFBIG 27 /* File too large */ |
#define ENOSPC 28 /* No space left on device */ |
#define ESPIPE 29 /* Illegal seek */ |
#define EROFS 30 /* Read-only file system */ |
#define EDOM 33 /* Argument to math function outside valid */ |
/* domain */ |
#define ERANGE 34 /* Math result cannot be represented */ |
#define EDEADLK 35 /* Resource deadlock would occur */ |
#define EDEADLOCK EDEADLK |
#define ENOSYS 38 /* Function not implemented */ |
#define ENAMETOOLONG 60 /* File name too long */ |
#define ENOTSUP 95 /* Not supported error */ |
#define EEOF 200 /* End of file reached */ |
#define ENOSUPP 201 /* Operation not supported */ |
#define EDEVNOSUPP 202 /* Device does not support this operation */ |
|
/* Additional errors used by networking */ |
#define ENXIO 300 /* Device not configured */ |
#define EACCES 301 /* Permission denied */ |
#define EEXIST 302 /* File exists */ |
#define ENOTTY 303 /* Inappropriate ioctl for device */ |
#define EPIPE 304 /* Broken pipe */ |
|
/* non-blocking and interrupt i/o */ |
#define EINPROGRESS 310 /* Operation now in progress */ |
#define EALREADY 311 /* Operation already in progress */ |
|
/* ipc/network software -- argument errors */ |
#define ENOTSOCK 320 /* Socket operation on non-socket */ |
#define EDESTADDRREQ 321 /* Destination address required */ |
#define EMSGSIZE 322 /* Message too long */ |
#define EPROTOTYPE 323 /* Protocol wrong type for socket */ |
#define ENOPROTOOPT 324 /* Protocol not available */ |
#define EPROTONOSUPPORT 325 /* Protocol not supported */ |
#define ESOCKTNOSUPPORT 326 /* Socket type not supported */ |
#define EOPNOTSUPP 327 /* Operation not supported */ |
#define EPFNOSUPPORT 328 /* Protocol family not supported */ |
#define EAFNOSUPPORT 329 /* Address family not supported by */ |
/* protocol family */ |
#define EADDRINUSE 330 /* Address already in use */ |
#define EADDRNOTAVAIL 331 /* Can't assign requested address */ |
|
/* ipc/network software -- operational errors */ |
#define ENETDOWN 350 /* Network is down */ |
#define ENETUNREACH 351 /* Network is unreachable */ |
#define ENETRESET 352 /* Network dropped connection on reset */ |
#define ECONNABORTED 353 /* Software caused connection abort */ |
#define ECONNRESET 354 /* Connection reset by peer */ |
#define ENOBUFS 355 /* No buffer space available */ |
#define EISCONN 356 /* Socket is already connected */ |
#define ENOTCONN 357 /* Socket is not connected */ |
#define ESHUTDOWN 358 /* Can't send after socket shutdown */ |
#define ETOOMANYREFS 359 /* Too many references: can't splice */ |
#define ETIMEDOUT 360 /* Operation timed out */ |
#define ECONNREFUSED 361 /* Connection refused */ |
|
#define EHOSTDOWN 364 /* Host is down */ |
#define EHOSTUNREACH 365 /* No route to host */ |
|
#ifdef __cplusplus |
} /* extern "C" */ |
#endif |
|
#endif /* CYGONCE_ERROR_CODES_H multiple inclusion protection */ |
|
/* EOF codes.h */ |
/include/strerror.h
0,0 → 1,91
#ifndef CYGONCE_ERROR_STRERROR_H |
#define CYGONCE_ERROR_STRERROR_H |
/*======================================================================== |
// |
// strerror.h |
// |
// ISO C strerror function |
// |
//======================================================================== |
//####ECOSGPLCOPYRIGHTBEGIN#### |
// ------------------------------------------- |
// This file is part of eCos, the Embedded Configurable Operating System. |
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
// |
// eCos is free software; you can redistribute it and/or modify it under |
// the terms of the GNU General Public License as published by the Free |
// Software Foundation; either version 2 or (at your option) any later version. |
// |
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
// WARRANTY; without even the implied warranty of MERCHANTABILITY or |
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
// for more details. |
// |
// You should have received a copy of the GNU General Public License along |
// with eCos; if not, write to the Free Software Foundation, Inc., |
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
// |
// As a special exception, if other files instantiate templates or use macros |
// or inline functions from this file, or you compile this file and link it |
// with other works to produce a work based on this file, this file does not |
// by itself cause the resulting work to be covered by the GNU General Public |
// License. However the source code for this file must still be made available |
// in accordance with section (3) of the GNU General Public License. |
// |
// This exception does not invalidate any other reasons why a work based on |
// this file might be covered by the GNU General Public License. |
// |
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
// at http://sources.redhat.com/ecos/ecos-license/ |
// ------------------------------------------- |
//####ECOSGPLCOPYRIGHTEND#### |
//======================================================================== |
//#####DESCRIPTIONBEGIN#### |
// |
// Author(s): jlarmour |
// Contributors: jlarmour |
// Date: 2000-04-14 |
// Purpose: This file provides the strerror() function |
// required by ISO C and POSIX 1003.1 |
// Description: |
// Usage: Do not include this file directly - use #include <string.h> |
// |
//####DESCRIPTIONEND#### |
// |
//======================================================================*/ |
|
/* CONFIGURATION */ |
|
#include <pkgconf/error.h> /* Configuration header */ |
|
/* INCLUDES */ |
|
#include <cyg/error/codes.h> /* for Cyg_ErrNo */ |
|
#ifdef __cplusplus |
extern "C" { |
#endif |
|
/* FUNCTION PROTOTYPES */ |
|
/* Standard strerror() function as described by ISO C 1990 chap. 7.11.6.2. |
* This is normally provided by <string.h> |
*/ |
|
extern char * |
strerror( Cyg_ErrNo ); |
|
/* prototype for the actual implementation. Equivalent to the above, but |
* used internally by this product in preference |
*/ |
|
extern char * |
__strerror( Cyg_ErrNo ); |
|
#ifdef __cplusplus |
} /* extern "C" */ |
#endif |
|
#endif /* CYGONCE_ERROR_STRERROR_H multiple inclusion protection */ |
|
/* EOF strerror.h */ |
/include/errno.h
0,0 → 1,98
#ifndef CYGONCE_ERROR_ERRNO_H |
#define CYGONCE_ERROR_ERRNO_H |
/*======================================================================== |
// |
// errno.h |
// |
// ISO C errno variable and constants |
// |
//======================================================================== |
//####ECOSGPLCOPYRIGHTBEGIN#### |
// ------------------------------------------- |
// This file is part of eCos, the Embedded Configurable Operating System. |
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
// |
// eCos is free software; you can redistribute it and/or modify it under |
// the terms of the GNU General Public License as published by the Free |
// Software Foundation; either version 2 or (at your option) any later version. |
// |
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
// WARRANTY; without even the implied warranty of MERCHANTABILITY or |
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
// for more details. |
// |
// You should have received a copy of the GNU General Public License along |
// with eCos; if not, write to the Free Software Foundation, Inc., |
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
// |
// As a special exception, if other files instantiate templates or use macros |
// or inline functions from this file, or you compile this file and link it |
// with other works to produce a work based on this file, this file does not |
// by itself cause the resulting work to be covered by the GNU General Public |
// License. However the source code for this file must still be made available |
// in accordance with section (3) of the GNU General Public License. |
// |
// This exception does not invalidate any other reasons why a work based on |
// this file might be covered by the GNU General Public License. |
// |
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
// at http://sources.redhat.com/ecos/ecos-license/ |
// ------------------------------------------- |
//####ECOSGPLCOPYRIGHTEND#### |
//======================================================================== |
//#####DESCRIPTIONBEGIN#### |
// |
// Author(s): jlarmour |
// Contributors: jlarmour |
// Date: 2000-04-14 |
// Purpose: This file provides the errno variable (or more strictly |
// expression) required by ISO C and POSIX 1003.1 |
// Description: |
// Usage: Do not include this file directly - use #include <errno.h> |
// |
//####DESCRIPTIONEND#### |
// |
//======================================================================*/ |
|
/* CONFIGURATION */ |
|
#include <pkgconf/error.h> /* Configuration header */ |
|
#ifdef CYGPKG_ERROR_ERRNO |
|
/* INCLUDES */ |
|
#include <cyg/error/codes.h> /* for Cyg_ErrNo */ |
|
#ifdef __cplusplus |
extern "C" { |
#endif |
|
/* FUNCTION PROTOTYPES */ |
|
|
#ifdef CYGSEM_ERROR_PER_THREAD_ERRNO |
|
extern Cyg_ErrNo * |
cyg_error_get_errno_p( void ) __attribute__((const)); |
|
#endif /* ifdef CYGSEM_ERROR_PER_THREAD_ERRNO */ |
|
|
/* VARIABLES */ |
|
#ifdef CYGSEM_ERROR_PER_THREAD_ERRNO |
# define errno (*cyg_error_get_errno_p()) /* Per-thread error status */ |
#else |
extern Cyg_ErrNo errno; /* Global error status */ |
#endif /* ifdef CYGSEM_ERROR_PER_THREAD_ERRNO */ |
|
#ifdef __cplusplus |
} /* extern "C" */ |
#endif |
|
#endif /* ifdef CYGPKG_ERROR_ERRNO */ |
|
#endif /* CYGONCE_ERROR_ERRNO_H multiple inclusion protection */ |
|
/* EOF errno.h */ |
/ChangeLog
0,0 → 1,106
2001-11-29 Jonathan Larmour <jlarmour@redhat.com> |
|
* include/errno.h: Don't use 'const' type qualifier any more. It |
gives warnings in new compilers now. |
* src/errno.cxx (cyg_error_get_errno_p): Ditto. |
|
2000-06-19 Nick Garnett <nickg@cygnus.co.uk> |
|
* include/errno.h (errno): Added extern modifier to non-per-thread |
instance of errno. |
|
2000-06-07 Nick Garnett <nickg@cygnus.co.uk> |
|
* src/strerror.cxx: |
* include/codes.h: Added ESPIPE. |
|
2000-06-02 Nick Garnett <nickg@cygnus.co.uk> |
|
* include/codes.h: |
* src/strerror.cxx: Added some more codes. |
|
2000-05-31 Nick Garnett <nickg@cygnus.co.uk> |
|
* src/strerror.cxx: |
* include/codes.h: Added EXDEV. |
|
2000-05-20 Jonathan Larmour <jlarmour@redhat.co.uk> |
|
* include/codes.h: Add EDEADLOCK synonym for EDEADLK |
Add ENFILE |
* src/strerror.cxx: Add blurb for ENFILE, ENOSPC, EDEADLK and ENOTSUP |
|
2000-05-02 Jonathan Larmour <jlarmour@redhat.co.uk> |
|
* include/codes.h: No need to conditionalize codes on CYGPKG_NET |
Tidy a bit. |
* src/errno.cxx: Move here from libc. Use kernel constant |
per-thread data slot, not a dynamic one. Generally tidy. |
* src/strerror.cxx: No need to conditionalize codes on CYGPKG_NET. |
Tidy a bit. |
|
2000-03-31 Nick Garnett <nickg@cygnus.co.uk> |
|
* include/codes.h: Added some further codes. |
|
2000-01-11 Gary Thomas <gthomas@cygnus.co.uk> |
|
* src/strerror.cxx (_strerror): |
* include/codes.h: Add in additional errors require to support |
networking. |
|
1999-04-14 John Dallaway <jld@cygnus.co.uk> |
|
* include/pkgconf/error.h: Add cdl_package doc attribute. |
|
1998-09-11 Bart Veer <bartv@cygnus.co.uk> |
|
* include/pkgconf/error.h: |
Sorting out dependencies for error package. |
|
Mon Aug 24 17:51:08 1998 Jonathan Larmour <jlarmour@cygnus.co.uk> |
|
* include/pkgconf/error.h: |
Add CDL for this package, for the configuration system. |
|
Wed Aug 12 11:04:27 BST 1998 Chris Provenzano <proven@cygnus.com> |
|
* Changelog: Initial ChangeLog entry. |
* include/codes.h: #include <cyg/infra/cyg_type.h> for define |
of externC. |
|
//=========================================================================== |
//####ECOSGPLCOPYRIGHTBEGIN#### |
// ------------------------------------------- |
// This file is part of eCos, the Embedded Configurable Operating System. |
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
// |
// eCos is free software; you can redistribute it and/or modify it under |
// the terms of the GNU General Public License as published by the Free |
// Software Foundation; either version 2 or (at your option) any later version. |
// |
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
// WARRANTY; without even the implied warranty of MERCHANTABILITY or |
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
// for more details. |
// |
// You should have received a copy of the GNU General Public License along |
// with eCos; if not, write to the Free Software Foundation, Inc., |
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
// |
// As a special exception, if other files instantiate templates or use macros |
// or inline functions from this file, or you compile this file and link it |
// with other works to produce a work based on this file, this file does not |
// by itself cause the resulting work to be covered by the GNU General Public |
// License. However the source code for this file must still be made available |
// in accordance with section (3) of the GNU General Public License. |
// |
// This exception does not invalidate any other reasons why a work based on |
// this file might be covered by the GNU General Public License. |
// |
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
// at http://sources.redhat.com/ecos/ecos-license/ |
// ------------------------------------------- |
//####ECOSGPLCOPYRIGHTEND#### |
//=========================================================================== |
|
/src/strerror.cxx
0,0 → 1,441
//=========================================================================== |
// |
// strerror.cxx |
// |
// ANSI error code string routine |
// |
//=========================================================================== |
//####ECOSGPLCOPYRIGHTBEGIN#### |
// ------------------------------------------- |
// This file is part of eCos, the Embedded Configurable Operating System. |
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
// |
// eCos is free software; you can redistribute it and/or modify it under |
// the terms of the GNU General Public License as published by the Free |
// Software Foundation; either version 2 or (at your option) any later version. |
// |
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
// WARRANTY; without even the implied warranty of MERCHANTABILITY or |
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
// for more details. |
// |
// You should have received a copy of the GNU General Public License along |
// with eCos; if not, write to the Free Software Foundation, Inc., |
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
// |
// As a special exception, if other files instantiate templates or use macros |
// or inline functions from this file, or you compile this file and link it |
// with other works to produce a work based on this file, this file does not |
// by itself cause the resulting work to be covered by the GNU General Public |
// License. However the source code for this file must still be made available |
// in accordance with section (3) of the GNU General Public License. |
// |
// This exception does not invalidate any other reasons why a work based on |
// this file might be covered by the GNU General Public License. |
// |
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
// at http://sources.redhat.com/ecos/ecos-license/ |
// ------------------------------------------- |
//####ECOSGPLCOPYRIGHTEND#### |
//=========================================================================== |
//#####DESCRIPTIONBEGIN#### |
// |
// Author(s): jlarmour |
// Contributors: |
// Date: 2000-04-14 |
// Purpose: To provide the strerror() implementation |
// Description: This implements strerror() as described in ANSI chap 7.11.6.2 |
// Usage: See <cyg/error/codes.h> |
// |
//####DESCRIPTIONEND#### |
// |
//=========================================================================== |
|
|
// CONFIGURATION |
|
#include <pkgconf/error.h> // Configuration header |
|
// INCLUDES |
|
#include <cyg/infra/cyg_type.h> // Common project-wide type definitions |
#include <cyg/infra/cyg_trac.h> // Tracing support |
#include <cyg/error/codes.h> // Error code definitions and header for this |
// file |
|
// EXPORTED SYMBOLS |
|
externC char * |
strerror( int errnum ) __attribute__ ((weak, alias("__strerror") )); |
|
// FUNCTIONS |
|
externC char * |
__strerror( int errnum ) |
{ |
register char *s; |
|
CYG_REPORT_FUNCNAMETYPE( "__strerror", "String form of error is \"%s\"" ); |
|
switch (errnum) |
{ |
|
#ifdef ENOERR |
case ENOERR: |
s = "No error"; |
break; |
#endif |
|
#ifdef EPERM |
case EPERM: |
s = "Not permitted"; |
break; |
#endif |
|
#ifdef ENOENT |
case ENOENT: |
s = "No such entity"; |
break; |
#endif |
|
#ifdef ESRCH |
case ESRCH: |
s = "No such process"; |
break; |
#endif |
|
#ifdef EINTR |
case EINTR: |
s = "Operation interrupted"; |
break; |
#endif |
|
#ifdef EIO |
case EIO: |
s = "I/O error"; |
break; |
#endif |
|
#ifdef EBADF |
case EBADF: |
s = "Bad file handle"; |
break; |
#endif |
|
#ifdef EAGAIN |
case EAGAIN: |
s = "Try again later"; |
break; |
#endif |
|
#ifdef ENOMEM |
case ENOMEM: |
s = "Out of memory"; |
break; |
#endif |
|
#ifdef EBUSY |
case EBUSY: |
s = "Resource busy"; |
break; |
#endif |
|
#ifdef ENODEV |
case ENODEV: |
s = "No such device"; |
break; |
#endif |
|
#ifdef ENOTDIR |
case ENOTDIR: |
s = "Not a directory"; |
break; |
#endif |
|
#ifdef EISDIR |
case EISDIR: |
s = "Is a directory"; |
break; |
#endif |
|
#ifdef EINVAL |
case EINVAL: |
s = "Invalid argument"; |
break; |
#endif |
|
#ifdef ENFILE |
case ENFILE: |
s = "Too many open files in system"; |
break; |
#endif |
|
#ifdef EMFILE |
case EMFILE: |
s = "Too many open files"; |
break; |
#endif |
|
#ifdef EFBIG |
case EFBIG: |
s = "File too large"; |
break; |
#endif |
|
#ifdef ENOSPC |
case ENOSPC: |
s = "No space left on device"; |
break; |
#endif |
|
#ifdef ESPIPE |
case ESPIPE: |
s = "Illegal seek"; |
break; |
#endif |
|
#ifdef EROFS |
case EROFS: |
s = "Read-only file system"; |
break; |
#endif |
|
#ifdef EDOM |
case EDOM: |
s = "Argument to math function outside valid domain"; |
break; |
#endif |
|
#ifdef ERANGE |
case ERANGE: |
s = "Math result cannot be represented"; |
break; |
#endif |
|
#ifdef EDEADLK |
case EDEADLK: |
s = "Resource deadlock would occur"; |
break; |
#endif |
|
#ifdef ENOSYS |
case ENOSYS: |
s = "Function not implemented"; |
break; |
#endif |
|
#ifdef ENAMETOOLONG |
case ENAMETOOLONG: |
s = "File name too long"; |
break; |
#endif |
|
#ifdef ENOTSUP |
case ENOTSUP: |
s = "Not supported"; |
break; |
#endif |
|
#ifdef EEOF |
case EEOF: |
s = "End of file reached"; |
break; |
#endif |
|
#ifdef ENOSUPP |
case ENOSUPP: |
s = "Operation not supported"; |
break; |
#endif |
|
#ifdef EDEVNOSUPP |
case EDEVNOSUPP: |
s = "Device does not support this operation"; |
break; |
#endif |
|
#ifdef EXDEV |
case EXDEV: |
s = "Improper link"; |
break; |
#endif |
|
// Additional errors used by networking |
#ifdef ENXIO |
case ENXIO: |
s = "Device not configured"; |
break; |
#endif |
#ifdef EACCES |
case EACCES: |
s = "Permission denied"; |
break; |
#endif |
#ifdef EEXIST |
case EEXIST: |
s = "File exists"; |
break; |
#endif |
#ifdef ENOTTY |
case ENOTTY: |
s = "Inappropriate ioctl for device"; |
break; |
#endif |
#ifdef EPIPE |
case EPIPE: |
s = "Broken pipe"; |
break; |
#endif |
#ifdef EINPROGRESS |
case EINPROGRESS: |
s = "Operation now in progress"; |
break; |
#endif |
#ifdef EALREADY |
case EALREADY: |
s = "Operation already in progress"; |
break; |
#endif |
#ifdef ENOTSOCK |
case ENOTSOCK: |
s = "Socket operation on non-socket"; |
break; |
#endif |
#ifdef EDESTADDRREQ |
case EDESTADDRREQ: |
s = "Destination address required"; |
break; |
#endif |
#ifdef EMSGSIZE |
case EMSGSIZE: |
s = "Message too long"; |
break; |
#endif |
#ifdef EPROTOTYPE |
case EPROTOTYPE: |
s = "Protocol wrong type for socket"; |
break; |
#endif |
#ifdef ENOPROTOOPT |
case ENOPROTOOPT: |
s = "Protocol not available"; |
break; |
#endif |
#ifdef EPROTONOSUPPORT |
case EPROTONOSUPPORT: |
s = "Protocol not supported"; |
break; |
#endif |
#ifdef ESOCKTNOSUPPORT |
case ESOCKTNOSUPPORT: |
s = "Socket type not supported"; |
break; |
#endif |
#ifdef EOPNOTSUPP |
case EOPNOTSUPP: |
s = "Operation not supported"; |
break; |
#endif |
#ifdef EPFNOSUPPORT |
case EPFNOSUPPORT: |
s = "Protocol family not supported"; |
break; |
#endif |
#ifdef EAFNOSUPPORT |
case EAFNOSUPPORT: |
s = "Address family not supported by protocol family"; |
break; |
#endif |
#ifdef EADDRINUSE |
case EADDRINUSE: |
s = "Address already in use"; |
break; |
#endif |
#ifdef EADDRNOTAVAIL |
case EADDRNOTAVAIL: |
s = "Can't assign requested address"; |
break; |
#endif |
#ifdef ENETDOWN |
case ENETDOWN: |
s = "Network is down"; |
break; |
#endif |
#ifdef ENETUNREACH |
case ENETUNREACH: |
s = "Network is unreachable"; |
break; |
#endif |
#ifdef ENETRESET |
case ENETRESET: |
s = "Network dropped connection on reset"; |
break; |
#endif |
#ifdef ECONNABORTED |
case ECONNABORTED: |
s = "Software caused connection abort"; |
break; |
#endif |
#ifdef ECONNRESET |
case ECONNRESET: |
s = "Connection reset by peer"; |
break; |
#endif |
#ifdef ENOBUFS |
case ENOBUFS: |
s = "No buffer space available"; |
break; |
#endif |
#ifdef EISCONN |
case EISCONN: |
s = "Socket is already connected"; |
break; |
#endif |
#ifdef ENOTCONN |
case ENOTCONN: |
s = "Socket is not connected"; |
break; |
#endif |
#ifdef ESHUTDOWN |
case ESHUTDOWN: |
s = "Can't send after socket shutdown"; |
break; |
#endif |
#ifdef ETOOMANYREFS |
case ETOOMANYREFS: |
s = "Too many references: can't splice"; |
break; |
#endif |
#ifdef ETIMEDOUT |
case ETIMEDOUT: |
s = "Operation timed out"; |
break; |
#endif |
#ifdef ECONNREFUSED |
case ECONNREFUSED: |
s = "Connection refused"; |
break; |
#endif |
#ifdef EHOSTDOWN |
case EHOSTDOWN: |
s = "Host is down"; |
break; |
#endif |
#ifdef EHOSTUNREACH |
case EHOSTUNREACH: |
s = "No route to host"; |
break; |
#endif |
|
default: |
s = "Unknown error"; |
break; |
|
} // switch |
|
CYG_REPORT_RETVAL(s); |
|
return s; |
} // __strerror() |
|
// EOF strerror.cxx |
/src/errno.cxx
0,0 → 1,121
//=========================================================================== |
// |
// errno.cxx |
// |
// ISO C and POSIX error code |
// |
//=========================================================================== |
//####ECOSGPLCOPYRIGHTBEGIN#### |
// ------------------------------------------- |
// This file is part of eCos, the Embedded Configurable Operating System. |
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
// |
// eCos is free software; you can redistribute it and/or modify it under |
// the terms of the GNU General Public License as published by the Free |
// Software Foundation; either version 2 or (at your option) any later version. |
// |
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
// WARRANTY; without even the implied warranty of MERCHANTABILITY or |
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
// for more details. |
// |
// You should have received a copy of the GNU General Public License along |
// with eCos; if not, write to the Free Software Foundation, Inc., |
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
// |
// As a special exception, if other files instantiate templates or use macros |
// or inline functions from this file, or you compile this file and link it |
// with other works to produce a work based on this file, this file does not |
// by itself cause the resulting work to be covered by the GNU General Public |
// License. However the source code for this file must still be made available |
// in accordance with section (3) of the GNU General Public License. |
// |
// This exception does not invalidate any other reasons why a work based on |
// this file might be covered by the GNU General Public License. |
// |
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
// at http://sources.redhat.com/ecos/ecos-license/ |
// ------------------------------------------- |
//####ECOSGPLCOPYRIGHTEND#### |
//=========================================================================== |
//#####DESCRIPTIONBEGIN#### |
// |
// Author(s): jlarmour |
// Contributors: jlarmour |
// Date: 2000-04-14 |
// Purpose: Provide the errno variable |
// Description: This file either provides the errno variable directly, |
// or if thread-safe, using a kernel per-thread data |
// access function |
// Usage: |
// |
//####DESCRIPTIONEND#### |
// |
//=========================================================================== |
|
// CONFIGURATION |
|
#include <pkgconf/system.h> |
#include <pkgconf/error.h> // Configuration header |
|
#ifdef CYGPKG_ERROR_ERRNO |
|
// INCLUDES |
|
#include <cyg/infra/cyg_type.h> // Common project-wide type definitions |
#include <cyg/infra/cyg_trac.h> // Common tracing functions |
#include <cyg/error/errno.h> // Header for this file |
|
#ifdef CYGSEM_ERROR_PER_THREAD_ERRNO |
# include <pkgconf/kernel.h> // kernel configuration |
# include <cyg/kernel/thread.hxx> // per-thread data |
# include <cyg/kernel/thread.inl> // per-thread data |
# include <cyg/kernel/mutex.hxx> // mutexes |
#endif |
|
// GLOBAL VARIABLES |
|
#ifndef CYGSEM_ERROR_PER_THREAD_ERRNO |
|
// errno is initialised to 0 at program startup - ANSI 7.1.4 |
Cyg_ErrNo errno = 0; |
|
#else // ifndef CYGSEM_ERROR_PER_THREAD_ERRNO |
|
# if defined(CYGDBG_USE_TRACING) && defined(CYGNUM_ERROR_ERRNO_TRACE_LEVEL) |
static int errno_trace = CYGNUM_ERROR_ERRNO_TRACE_LEVEL; |
# define TL1 (0 < errno_trace) |
# else |
# define TL1 (0) |
# endif |
|
// FUNCTIONS |
|
Cyg_ErrNo * |
cyg_error_get_errno_p( void ) |
{ |
Cyg_ErrNo *errno_p; |
|
CYG_REPORT_FUNCNAMETYPE( "cyg_error_get_errno_p", "&errno is %d"); |
|
// set up the thread data, allocating if necessary (even though the |
// user _shouldn't_ read errno before its set, we can't stop them - and |
// ANSI prescribes it has a sensible value (0) before its set too anyway. |
|
Cyg_Thread *self = Cyg_Thread::self(); |
|
errno_p = (Cyg_ErrNo *)self->get_data_ptr(CYGNUM_KERNEL_THREADS_DATA_ERRNO); |
|
CYG_TRACE1( TL1, "errno is %d", *errno_p ); |
|
CYG_REPORT_RETVAL( errno_p ); |
|
// return the internal data's errno |
return errno_p; |
} // cyg_error_get_errno_p() |
|
#endif // ifdef CYGSEM_ERROR_PER_THREAD_ERRNO |
|
#endif // ifdef CYGPKG_ERROR_ERRNO |
|
// EOF errno.cxx |