1 /***************************************************************************
2  * Copyright (c) 2024 Microsoft Corporation
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the MIT License which is available at
6  * https://opensource.org/licenses/MIT.
7  *
8  * SPDX-License-Identifier: MIT
9  **************************************************************************/
10 
11 
12 /**************************************************************************/
13 /**************************************************************************/
14 /**                                                                       */
15 /** ThreadX Component                                                     */
16 /**                                                                       */
17 /**   Module                                                              */
18 /**                                                                       */
19 /**************************************************************************/
20 /**************************************************************************/
21 
22 #define TXM_MODULE
23 #include "txm_module.h"
24 #ifndef TXM_MUTEX_INFO_GET_CALL_NOT_USED
25 /**************************************************************************/
26 /*                                                                        */
27 /*  FUNCTION                                               RELEASE        */
28 /*                                                                        */
29 /*    _txe_mutex_info_get                                 PORTABLE C      */
30 /*                                                           6.1.10       */
31 /*  AUTHOR                                                                */
32 /*                                                                        */
33 /*    Scott Larson, Microsoft Corporation                                 */
34 /*                                                                        */
35 /*  DESCRIPTION                                                           */
36 /*                                                                        */
37 /*    This function checks for errors in the mutex information get        */
38 /*    service.                                                            */
39 /*                                                                        */
40 /*  INPUT                                                                 */
41 /*                                                                        */
42 /*    mutex_ptr                         Pointer to mutex control block    */
43 /*    name                              Destination for the mutex name    */
44 /*    count                             Destination for the owner count   */
45 /*    owner                             Destination for the owner's       */
46 /*                                        thread control block pointer    */
47 /*    first_suspended                   Destination for pointer of first  */
48 /*                                        thread suspended on the mutex   */
49 /*    suspended_count                   Destination for suspended count   */
50 /*    next_mutex                        Destination for pointer to next   */
51 /*                                        mutex on the created list       */
52 /*                                                                        */
53 /*  OUTPUT                                                                */
54 /*                                                                        */
55 /*    TX_MUTEX_ERROR                    Invalid mutex pointer             */
56 /*    status                            Completion status                 */
57 /*                                                                        */
58 /*  CALLS                                                                 */
59 /*                                                                        */
60 /*    _txm_module_kernel_call_dispatcher                                  */
61 /*                                                                        */
62 /*  CALLED BY                                                             */
63 /*                                                                        */
64 /*    Module application code                                             */
65 /*                                                                        */
66 /*  RELEASE HISTORY                                                       */
67 /*                                                                        */
68 /*    DATE              NAME                      DESCRIPTION             */
69 /*                                                                        */
70 /*  09-30-2020      Scott Larson            Initial Version 6.1           */
71 /*  01-31-2022      Scott Larson            Modified comments and added   */
72 /*                                            CALL_NOT_USED option,       */
73 /*                                            resulting in version 6.1.10 */
74 /*                                                                        */
75 /**************************************************************************/
_txe_mutex_info_get(TX_MUTEX * mutex_ptr,CHAR ** name,ULONG * count,TX_THREAD ** owner,TX_THREAD ** first_suspended,ULONG * suspended_count,TX_MUTEX ** next_mutex)76 UINT _txe_mutex_info_get(TX_MUTEX *mutex_ptr, CHAR **name, ULONG *count, TX_THREAD **owner, TX_THREAD **first_suspended, ULONG *suspended_count, TX_MUTEX **next_mutex)
77 {
78 
79 UINT return_value;
80 ALIGN_TYPE extra_parameters[5];
81 
82     extra_parameters[0] = (ALIGN_TYPE) count;
83     extra_parameters[1] = (ALIGN_TYPE) owner;
84     extra_parameters[2] = (ALIGN_TYPE) first_suspended;
85     extra_parameters[3] = (ALIGN_TYPE) suspended_count;
86     extra_parameters[4] = (ALIGN_TYPE) next_mutex;
87 
88     /* Call module manager dispatcher.  */
89     return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_MUTEX_INFO_GET_CALL, (ALIGN_TYPE) mutex_ptr, (ALIGN_TYPE) name, (ALIGN_TYPE) extra_parameters);
90 
91     /* Return value to the caller.  */
92     return(return_value);
93 }
94 #endif
95