1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22 /* 23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #pragma ident "@(#)errors.h 1.11 09/05/26 SMI" 28 29 #ifndef _ERRORS_H 30 #define _ERRORS_H 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 36 #include <libintl.h> 37 #include <errno.h> 38 39 #define SHM_INIT_ERROR(A, B) \ 40 pperror(gettext("shm_%s_init(%#lx) failed, %s:%d"), \ 41 shm_ops->name(A), B, __FILE__, __LINE__) 42 #define ATTACH_ERROR(A) plog(LOG_WARNING, \ 43 gettext("shm_%s_attach failed, %s:%d %s"), \ 44 shm_ops->name(A), __FILE__, __LINE__, strerror(errno)) 45 #define OPEN_ERROR(A, B) pperror(gettext("Unable to open(%s, %s)"), A, #B) 46 #define FOPEN_ERROR(A, B) pperror(gettext("Unable to fopen(%s, %s)"), A, B) 47 #define STAT_ERROR(A) pperror(gettext("Unable to stat(%s)"), A) 48 #define FSTAT_ERROR(A, B) pperror(gettext("Unable to fstat(%d (%s))"), A, B) 49 #define FSYNC_ERROR(A, B) pperror(gettext("Unable to fsync(%d (%s))"), A, B) 50 #define CLOSE_ERROR(A, B) pperror(gettext("Unable to close(%d (%s))"), A, B) 51 #define CALLOC_ERROR(A, B) pperror(gettext("calloc(%#lx, %#lx)"), A, B) 52 #define MALLOC_ERROR(A) pperror(gettext("malloc(%ld)"), A) 53 #define STRDUP_ERROR(A) pperror(gettext("strdup(%s)"), A) 54 #define REALLOC_ERROR(A, B) pperror(gettext("realloc(%lx, %ld)"), (ulong_t)A, \ 55 (ulong_t)B) 56 #define AIOREAD_ERROR(A, S, B, C, D, E, F) \ 57 pperror(gettext("aioread(%d (%s), %#lX, %#X, %#llX, %s, %#lX)"), \ 58 A, S, (ulong_t)B, C, D, #E, (ulong_t)F) 59 #define AIOWRITE_ERROR(A, S, B, C, D, E, F) \ 60 pperror(gettext("aiowrite(%d (%s), %#lX, %#X, %#llX, %s, %#lX)"), \ 61 A, S, (ulong_t)B, C, D, #E, F) 62 #define AIOWAIT_ERROR(T) pperror(gettext("aiowait(%ld.%5.5ld)"), \ 63 T.tv_sec, T.tv_usec) 64 #define AIOCANCEL_ERROR(A) pperror(gettext("aiocancel(%d,%d (%s)"), \ 65 DAIO_RETURN((A)->aio_res), DAIO_ERROR((A)->aio_res), \ 66 (A)->fd->name) 67 #define FORK_ERROR(A) pperror(gettext("fork%s"), A) 68 #define PREAD_ERROR(A, B, C, D, E) \ 69 pperror(gettext("pread(%d (%s), %#lx, %d, %#llx)"), \ 70 A, B, C, D, (long long)E) 71 #define PWRITE_ERROR(A, B, C, D, E) \ 72 pperror(gettext("pwrite(%d (%s), %#lx, %d, %#lx)"), \ 73 A, B, C, D, E) 74 #define MADVISE_ERROR(A, B, C, D) \ 75 pperror(gettext("madvise(%#lx, %#x, %#x (%s))"), \ 76 A, B, C, D); 77 78 #ifdef __cplusplus 79 } 80 #endif 81 82 #endif /* _ERRORS_H */ 83