source: rtems/cpukit/include/rtems/posix/aio_misc.h @ 21275b58

5
Last change on this file since 21275b58 was 2afb22b, checked in by Chris Johns <chrisj@…>, on 12/23/17 at 07:18:56

Remove make preinstall

A speciality of the RTEMS build system was the make preinstall step. It
copied header files from arbitrary locations into the build tree. The
header files were included via the -Bsome/build/tree/path GCC command
line option.

This has at least seven problems:

  • The make preinstall step itself needs time and disk space.
  • Errors in header files show up in the build tree copy. This makes it hard for editors to open the right file to fix the error.
  • There is no clear relationship between source and build tree header files. This makes an audit of the build process difficult.
  • The visibility of all header files in the build tree makes it difficult to enforce API barriers. For example it is discouraged to use BSP-specifics in the cpukit.
  • An introduction of a new build system is difficult.
  • Include paths specified by the -B option are system headers. This may suppress warnings.
  • The parallel build had sporadic failures on some hosts.

This patch removes the make preinstall step. All installed header
files are moved to dedicated include directories in the source tree.
Let @RTEMS_CPU@ be the target architecture, e.g. arm, powerpc, sparc,
etc. Let @RTEMS_BSP_FAMILIY@ be a BSP family base directory, e.g.
erc32, imx, qoriq, etc.

The new cpukit include directories are:

  • cpukit/include
  • cpukit/score/cpu/@RTEMS_CPU@/include
  • cpukit/libnetworking

The new BSP include directories are:

  • bsps/include
  • bsps/@RTEMS_CPU@/include
  • bsps/@RTEMS_CPU@/@RTEMS_BSP_FAMILIY@/include

There are build tree include directories for generated files.

The include directory order favours the most general header file, e.g.
it is not possible to override general header files via the include path
order.

The "bootstrap -p" option was removed. The new "bootstrap -H" option
should be used to regenerate the "headers.am" files.

Update #3254.

  • Property mode set to 100644
File size: 2.8 KB
Line 
1/**
2 * @file
3 *
4 * @brief POSIX Asynchronous Input and Output Private Support
5 *
6 * This defines private information for the AIO implementation.
7 */
8
9/*
10 * Copyright 2010, Alin Rus <alin.codejunkie@gmail.com>
11 *
12 * The license and distribution terms for this file may be
13 * found in the file LICENSE in this distribution or at
14 * http://www.rtems.org/license/LICENSE.
15 */
16
17#ifndef _AIO_MISC_H
18#define _AIO_MISC_H
19
20#include <stdio.h>
21#include <string.h>
22#include <aio.h>
23#include <pthread.h>
24#include <rtems.h>
25#include <rtems/chain.h>
26#include <rtems/system.h>
27#include <rtems/seterr.h>
28 
29#ifdef __cplusplus
30extern "C"
31{
32#endif
33
34  /* Actual request being processed */
35  typedef struct
36  {
37    rtems_chain_node next_prio; /* chain requests in order of priority */
38    int policy;                 /* If _POSIX_PRIORITIZED_IO and
39                                   _POSIX_PRIORITY_SCHEDULING are defined */
40    int priority;               /* see above */
41    pthread_t caller_thread;    /* used for notification */
42    struct aiocb *aiocbp;       /* aio control block */
43  } rtems_aio_request;
44
45  typedef struct
46  {
47    rtems_chain_node next_fd;   /* order fd chains in queue */
48    rtems_chain_control perfd;  /* chain of requests for this fd */
49    int fildes;                 /* file descriptor to be processed */
50    int new_fd;                 /* if this is a newly created chain */
51    pthread_mutex_t mutex;     
52    pthread_cond_t cond;
53
54  } rtems_aio_request_chain;
55
56  typedef struct
57  {
58    pthread_mutex_t mutex;
59    pthread_cond_t new_req;
60    pthread_attr_t attr;
61
62    rtems_chain_control work_req; /* chains being worked by active threads */
63    rtems_chain_control idle_req; /* fd chains waiting to be processed */
64    unsigned int initialized;     /* specific value if queue is initialized */
65    int active_threads;           /* the number of active threads */
66    int idle_threads;             /* number of idle threads */
67
68  } rtems_aio_queue;
69
70extern rtems_aio_queue aio_request_queue;
71
72#define AIO_QUEUE_INITIALIZED 0xB00B
73
74#ifndef AIO_MAX_THREADS
75#define AIO_MAX_THREADS 5
76#endif
77
78#ifndef AIO_MAX_QUEUE_SIZE
79#define AIO_MAX_QUEUE_SIZE 30
80#endif
81
82int rtems_aio_init (void);
83int rtems_aio_enqueue (rtems_aio_request *req);
84rtems_aio_request_chain *rtems_aio_search_fd
85(
86  rtems_chain_control *chain,
87  int fildes,
88  int create
89);
90void rtems_aio_remove_fd (rtems_aio_request_chain *r_chain);
91int rtems_aio_remove_req (rtems_chain_control *chain,
92                                 struct aiocb *aiocbp);
93
94#ifdef RTEMS_DEBUG
95#include <assert.h>
96
97#define AIO_assert(_x) assert(_x)
98#define AIO_printf(_x) printf(_x)
99#else
100#define AIO_assert(_x)
101#define AIO_printf(_x)
102#endif
103
104#define rtems_aio_set_errno_return_minus_one( _error, _aiocbp ) \
105  do { (_aiocbp)->error_code = (_error);                        \
106    (_aiocbp)->return_value = -1;                               \
107    rtems_set_errno_and_return_minus_one (_error);} while(0)
108
109#ifdef __cplusplus
110}
111#endif
112
113#endif
Note: See TracBrowser for help on using the repository browser.