pal_host.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /* -*- mode:c; c-file-style:"k&r"; c-basic-offset: 4; tab-width:4; indent-tabs-mode:nil; mode:auto-fill; fill-column:78; -*- */
  2. /* vim: set ts=4 sw=4 et tw=78 fo=cqt wm=0: */
  3. /* Copyright (C) 2014 Stony Brook University
  4. This file is part of Graphene Library OS.
  5. Graphene Library OS is free software: you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public License
  7. as published by the Free Software Foundation, either version 3 of the
  8. License, or (at your option) any later version.
  9. Graphene Library OS is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public License
  14. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  15. /*
  16. * pal_host.h
  17. *
  18. * This file contains definition of PAL host ABI.
  19. */
  20. #ifndef PAL_HOST_H
  21. #define PAL_HOST_H
  22. #ifndef IN_PAL
  23. # error "cannot be included outside PAL"
  24. #endif
  25. typedef int PAL_LOCK;
  26. #define LOCK_INIT (0)
  27. typedef struct pal_handle
  28. {
  29. /* TSAI: Here we define the internal types of PAL_HANDLE
  30. * in PAL design, user has not to access the content inside the
  31. * handle, also there is no need to allocate the internal
  32. * handles, so we hide the type name of these handles on purpose.
  33. */
  34. PAL_HDR hdr;
  35. union {
  36. struct {
  37. PAL_IDX fds[2];
  38. } generic;
  39. /* DP: Here we just define a placeholder fd; place your details here.
  40. * Not every type requires an fd either - this is up to your
  41. * host-specific code.
  42. */
  43. struct {
  44. PAL_IDX fd;
  45. } file;
  46. struct {
  47. PAL_IDX fd;
  48. } pipe;
  49. struct {
  50. PAL_IDX fd;
  51. } pipeprv;
  52. struct {
  53. PAL_IDX fd;
  54. PAL_IDX dev_type;
  55. } dev;
  56. struct {
  57. PAL_IDX fd;
  58. } dir;
  59. struct {
  60. PAL_IDX fd;
  61. } gipc;
  62. struct {
  63. PAL_IDX fd;
  64. } sock;
  65. struct {
  66. PAL_IDX fd;
  67. } process;
  68. struct {
  69. PAL_IDX fd;
  70. } mcast;
  71. struct {
  72. PAL_IDX fd;
  73. } thread;
  74. struct {
  75. PAL_IDX fd;
  76. } semaphore;
  77. struct {
  78. PAL_IDX fd;
  79. } event;
  80. };
  81. } * PAL_HANDLE;
  82. #endif /* PAL_HOST_H */