fspr_arch_threadproc.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /* Licensed to the Apache Software Foundation (ASF) under one or more
  2. * contributor license agreements. See the NOTICE file distributed with
  3. * this work for additional information regarding copyright ownership.
  4. * The ASF licenses this file to You under the Apache License, Version 2.0
  5. * (the "License"); you may not use this file except in compliance with
  6. * the License. You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #include "fspr_thread_proc.h"
  17. #include "fspr_arch_file_io.h"
  18. #include "fspr_file_io.h"
  19. #include "fspr_thread_proc.h"
  20. #include "fspr_general.h"
  21. #include "fspr_portable.h"
  22. #include <kernel/OS.h>
  23. #include <signal.h>
  24. #include <string.h>
  25. #include <sys/wait.h>
  26. #include <image.h>
  27. #ifndef THREAD_PROC_H
  28. #define THREAD_PROC_H
  29. #define SHELL_PATH "/bin/sh"
  30. #define PTHREAD_CANCEL_AYNCHRONOUS CANCEL_ASYNCH;
  31. #define PTHREAD_CANCEL_DEFERRED CANCEL_DEFER;
  32. #define PTHREAD_CANCEL_ENABLE CANCEL_ENABLE;
  33. #define PTHREAD_CANCEL_DISABLE CANCEL_DISABLE;
  34. #define BEOS_MAX_DATAKEYS 128
  35. struct fspr_thread_t {
  36. fspr_pool_t *pool;
  37. thread_id td;
  38. void *data;
  39. fspr_thread_start_t func;
  40. fspr_status_t exitval;
  41. };
  42. struct fspr_threadattr_t {
  43. fspr_pool_t *pool;
  44. int32 attr;
  45. int detached;
  46. int joinable;
  47. };
  48. struct fspr_threadkey_t {
  49. fspr_pool_t *pool;
  50. int32 key;
  51. };
  52. struct beos_private_data {
  53. const void ** data;
  54. int count;
  55. volatile thread_id td;
  56. };
  57. struct beos_key {
  58. int assigned;
  59. int count;
  60. sem_id lock;
  61. int32 ben_lock;
  62. void (* destructor) (void *);
  63. };
  64. struct fspr_procattr_t {
  65. fspr_pool_t *pool;
  66. fspr_file_t *parent_in;
  67. fspr_file_t *child_in;
  68. fspr_file_t *parent_out;
  69. fspr_file_t *child_out;
  70. fspr_file_t *parent_err;
  71. fspr_file_t *child_err;
  72. char *currdir;
  73. fspr_int32_t cmdtype;
  74. fspr_int32_t detached;
  75. };
  76. struct fspr_thread_once_t {
  77. sem_id sem;
  78. int hit;
  79. };
  80. #endif /* ! THREAD_PROC_H */