xref: /haiku/headers/private/kernel/port.h (revision 24159a0c7d6d6dcba9f2a0c1a7c08d2c8167f21b)
1 /*
2  * Copyright 2005, Haiku Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT license.
4  */
5 #ifndef _KERNEL_PORT_H
6 #define _KERNEL_PORT_H
7 
8 
9 #include <thread.h>
10 #include <iovec.h>
11 
12 struct kernel_args;
13 
14 
15 #define PORT_FLAG_USE_USER_MEMCPY 0x80000000
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 status_t port_init(struct kernel_args *args);
22 int delete_owned_ports(team_id owner);
23 int32 port_max_ports(void);
24 int32 port_used_ports(void);
25 
26 // currently private API
27 status_t writev_port_etc(port_id id, int32 msgCode, const iovec *msgVecs,
28 			size_t vecCount, size_t bufferSize, uint32 flags, bigtime_t timeout);
29 
30 // temp: test
31 void port_test(void);
32 
33 // user syscalls
34 port_id		_user_create_port(int32 queueLength, const char *name);
35 status_t	_user_close_port(port_id id);
36 status_t	_user_delete_port(port_id id);
37 port_id		_user_find_port(const char *portName);
38 status_t	_user_get_port_info(port_id id, struct port_info *info);
39 status_t 	_user_get_next_port_info(team_id team, int32 *cookie,
40 				struct port_info *info);
41 ssize_t		_user_port_buffer_size_etc(port_id port, uint32 flags,
42 				bigtime_t timeout);
43 ssize_t		_user_port_count(port_id port);
44 ssize_t		_user_read_port_etc(port_id port, int32 *msgCode,
45 				void *msgBuffer, size_t bufferSize, uint32 flags,
46 				bigtime_t timeout);
47 status_t	_user_set_port_owner(port_id port, team_id team);
48 status_t	_user_write_port_etc(port_id port, int32 msgCode,
49 				const void *msgBuffer, size_t bufferSize,
50 				uint32 flags, bigtime_t timeout);
51 status_t	_user_writev_port_etc(port_id id, int32 msgCode,
52 				const iovec *msgVecs, size_t vecCount,
53 				size_t bufferSize, uint32 flags, bigtime_t timeout);
54 
55 #ifdef __cplusplus
56 }
57 #endif
58 
59 #endif	/* _KERNEL_PORT_H */
60