xref: /haiku/headers/private/kernel/port.h (revision 636bfc08aeaaa7f1bab813c5aa2e8e666b40ec64)
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 struct select_info;
14 
15 
16 #define PORT_FLAG_USE_USER_MEMCPY 0x80000000
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 status_t port_init(struct kernel_args *args);
23 int delete_owned_ports(team_id owner);
24 int32 port_max_ports(void);
25 int32 port_used_ports(void);
26 
27 status_t select_port(int32 object, struct select_info *info, bool kernel);
28 status_t deselect_port(int32 object, struct select_info *info, bool kernel);
29 
30 // currently private API
31 status_t writev_port_etc(port_id id, int32 msgCode, const iovec *msgVecs,
32 			size_t vecCount, size_t bufferSize, uint32 flags, bigtime_t timeout);
33 
34 // temp: test
35 void port_test(void);
36 
37 // user syscalls
38 port_id		_user_create_port(int32 queueLength, const char *name);
39 status_t	_user_close_port(port_id id);
40 status_t	_user_delete_port(port_id id);
41 port_id		_user_find_port(const char *portName);
42 status_t	_user_get_port_info(port_id id, struct port_info *info);
43 status_t 	_user_get_next_port_info(team_id team, int32 *cookie,
44 				struct port_info *info);
45 ssize_t		_user_port_buffer_size_etc(port_id port, uint32 flags,
46 				bigtime_t timeout);
47 ssize_t		_user_port_count(port_id port);
48 ssize_t		_user_read_port_etc(port_id port, int32 *msgCode,
49 				void *msgBuffer, size_t bufferSize, uint32 flags,
50 				bigtime_t timeout);
51 status_t	_user_set_port_owner(port_id port, team_id team);
52 status_t	_user_write_port_etc(port_id port, int32 msgCode,
53 				const void *msgBuffer, size_t bufferSize,
54 				uint32 flags, bigtime_t timeout);
55 status_t	_user_writev_port_etc(port_id id, int32 msgCode,
56 				const iovec *msgVecs, size_t vecCount,
57 				size_t bufferSize, uint32 flags, bigtime_t timeout);
58 
59 #ifdef __cplusplus
60 }
61 #endif
62 
63 #endif	/* _KERNEL_PORT_H */
64