2 * See the file LICENSE for redistribution information.
4 * Copyright (c) 1999-2009 Oracle. All rights reserved.
14 * __os_get_errno_ret_zero --
15 * Return the last system error, including an error of zero.
18 __os_get_errno_ret_zero()
20 /* This routine must be able to return the same value repeatedly. */
25 * We've seen cases where system calls failed but errno was never set. For
26 * that reason, __os_get_errno() and __os_get_syserr set errno to EAGAIN if
27 * it's not already set, to work around the problem. For obvious reasons,
28 * we can only call this function if we know an error has occurred, that
29 * is, we can't test the return for a non-zero value after the get call.
32 * Return the last ANSI C "errno" value or EAGAIN if the last error
38 /* This routine must be able to return the same value repeatedly. */
40 __os_set_errno(EAGAIN);
46 * Return the last system error or EAGAIN if the last error is zero.
51 /* This routine must be able to return the same value repeatedly. */
53 __os_set_errno(EAGAIN);
59 * Set the value of errno.
62 __os_set_errno(evalue)
66 * This routine is called by the compatibility interfaces (DB 1.85,
67 * dbm and hsearch). Force values > 0, that is, not one of DB 2.X
68 * and later's public error returns. If something bad has happened,
69 * default to EFAULT -- a nasty return. Otherwise, default to EINVAL.
70 * As the compatibility APIs aren't included on Windows, the Windows
71 * version of this routine doesn't need this behavior.
74 evalue >= 0 ? evalue : (evalue == DB_RUNRECOVERY ? EFAULT : EINVAL);
79 * Return a string associated with the system error.
82 __os_strerror(error, buf, len)
96 #ifndef HAVE_BREW_SDK2
119 #ifndef HAVE_BREW_SDK2
120 case EINVALIDOPERATION:
121 p = "EINVALIDOPERATION";
134 p = __db_unknown_error(error);
138 (void)strncpy(buf, p, len - 1);
146 * Convert a system error to a POSIX error.
149 __os_posix_err(error)
156 #ifndef HAVE_BREW_SDK2
176 #ifndef HAVE_BREW_SDK2
177 case EINVALIDOPERATION: