Warning: This file is not a C or C++ file. It does not have highlighting.
1 | #ifndef _HURD_PORT_H |
---|---|
2 | #include_next <hurd/port.h> |
3 | |
4 | #ifndef _ISOMAC |
5 | #include <libc-lock.h> |
6 | |
7 | struct _hurd_port_use_data |
8 | { |
9 | struct hurd_port *p; |
10 | struct hurd_userlink link; |
11 | mach_port_t port; |
12 | }; |
13 | |
14 | extern void _hurd_port_use_cleanup (void *arg); |
15 | |
16 | /* Like HURD_PORT_USE, but cleans fd on cancel. */ |
17 | #define HURD_PORT_USE_CANCEL(portcell, expr) \ |
18 | ({ struct _hurd_port_use_data __d; \ |
19 | mach_port_t port; \ |
20 | __typeof(expr) __result; \ |
21 | void *__crit; \ |
22 | __d.p = (portcell); \ |
23 | __crit = _hurd_critical_section_lock (); \ |
24 | __d.port = port = _hurd_port_get (__d.p, &__d.link); \ |
25 | __libc_cleanup_push (_hurd_port_use_cleanup, &__d); \ |
26 | _hurd_critical_section_unlock (__crit); \ |
27 | __result = (expr); \ |
28 | __libc_cleanup_pop (1); \ |
29 | __result; }) |
30 | |
31 | libc_hidden_proto (_hurd_port_locked_get) |
32 | libc_hidden_proto (_hurd_port_locked_set) |
33 | #ifdef _HURD_PORT_H_HIDDEN_DEF |
34 | libc_hidden_def (_hurd_port_locked_get) |
35 | libc_hidden_def (_hurd_port_locked_set) |
36 | #endif |
37 | #endif |
38 | #endif |
39 |
Warning: This file is not a C or C++ file. It does not have highlighting.