source: rtems/cpukit/score/include/rtems/seterr.h @ 64939bc

4.115
Last change on this file since 64939bc was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/**
2 *  @file  rtems/seterr.h
3 *
4 *  @brief Data which Ease the Burden of Consistently Setting Errno
5 *
6 *  This file contains macros and definitions which ease the burden
7 *  of consistently setting errno and returning -1.
8 */
9
10/*
11 *  COPYRIGHT (c) 1989-2006.
12 *  On-Line Applications Research Corporation (OAR).
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.org/license/LICENSE.
17 */
18
19#ifndef _RTEMS_SETERR_H
20#define _RTEMS_SETERR_H
21
22/**
23 *  @defgroup ScoreSetErr Set Errno
24 *
25 *  @ingroup Score
26 *
27 */
28/**@{*/
29
30#include <errno.h>
31
32/**
33 *  This is a helper macro which will set the variable errno and return
34 *  -1 to the caller.  This pattern is common to many POSIX methods.
35 *
36 *  @param[in] _error is the error code
37 */
38#define rtems_set_errno_and_return_minus_one( _error ) \
39  do { errno = (_error); return -1; } while(0)
40
41/**
42 *  This is a helper macro which will set the variable errno and return
43 *  -1 to the caller.  This pattern is common to many POSIX methods.
44 *
45 *  @param[in] _error is the error code
46 *  @param[in] _cast is the type to which -1 must be cast
47 *
48 *  @note It is similar to @ref rtems_set_errno_and_return_minus_one but
49 *        this -1 value is cast to something other than an int.
50 */
51#define rtems_set_errno_and_return_minus_one_cast( _error, _cast ) \
52  do { errno = (_error); return (_cast) -1; } while(0)
53
54/**@}*/
55#endif
56/* end of include file */
Note: See TracBrowser for help on using the repository browser.