generic
[Libc]


Files

file  align.h
file  arg_parse.h
file  arp.h
 ARP module messages.
file  as.c
file  as.h
file  asprintf.c
file  assert.h
file  async.c
file  async.h
file  async.h
file  async_sess.c
file  async_sess.h
file  async_sess.h
file  atomic.h
file  atomicdflt.h
file  bool.h
file  byteorder.h
file  canonify.c
file  canonify.h
file  cap.c
 Functions to grant/revoke capabilities to/from a task.
file  cap.h
file  char_dev.c
file  char_dev.h
file  char_map.c
 Character string to integer map implementation.
file  char_map.h
 Character string to integer map.
file  clipboard.c
 System clipboard API.
file  clipboard.h
file  color.h
file  console.c
file  console.h
file  ctype.h
file  ddi.c
file  ddi.h
file  device.h
 Device identifier, state and usage statistics.
file  devman.c
file  devman.h
file  devmap.h
file  dirent.h
file  dynamic.h
file  dynamic_fifo.c
 Dynamic first in first out positive integer queue implementation.
file  dynamic_fifo.h
 Dynamic first in first out positive integer queue.
file  elf_dyn.h
file  entry.h
file  entry_point.h
file  err.h
file  errno.c
file  errno.h
file  event.h
file  fcntl.h
file  fibril.c
file  fibril.h
file  fibril_synch.c
file  fibril_synch.h
file  fifo.h
file  futex.c
file  futex.h
file  gcdlcm.h
file  generic_char_map.h
 Character string to generic type map.
file  generic_field.h
 Generic type field.
file  hash_table.c
file  hash_table.h
file  hw_res.c
file  hw_res.h
file  icmp.h
 ICMP module messages.
file  icmp_api.c
 ICMP application interface implementation.
file  icmp_api.h
 ICMP module application interface.
file  icmp_codes.h
 ICMP types and codes according to the on-line IANA - ICMP Type Numbers.
file  icmp_common.c
 ICMP common interface implementation.
file  icmp_common.h
 ICMP module common interface.
file  il.h
 Internetwork layer modules messages.
file  in.h
 INET family common definitions.
file  in6.h
 INET6 family common definitions.
file  inet.c
 Internet protocol address conversion functions implementation.
file  inet.h
 Internet common definitions.
file  int_map.h
 Integer to generic type map.
file  inttypes.h
file  io.c
file  io.h
file  ip.h
 IP module messages.
file  ip_codes.h
 IP codes and definitions.
file  ip_protocols.h
 Internet protocol numbers according to the on-line IANA - Assigned Protocol numbers:.
file  keycode.h
file  klog.c
file  klog.h
file  langs.c
 Language and locale ids.
file  langs.h
 Language and locale ids.
file  libc.c
file  libc.h
file  libc.h
file  list.c
file  list.h
file  loader.c
file  macros.h
file  malloc.c
file  malloc.h
file  malloc.h
file  measured_strings.c
 Character string with measured length implementation.
file  measured_strings.h
 Character string with measured length.
file  mem.c
file  mem.h
file  mman.c
file  mman.h
file  module.h
file  modules.c
 Generic module functions implementation.
file  modules.h
 Generic module functions.
file  net_net.h
 Networking subsystem central module messages.
file  netif.h
 Network interface common module messages.
file  nil.h
 Network interface layer module messages.
file  ns.c
file  packet.c
 Packet map and queue implementation.
file  packet.h
 Packet map and queue.
file  packet.h
 Packet server module messages.
file  packet_header.h
 Packet header.
file  pcb.c
file  printf.c
file  printf_core.h
file  prodcons.c
file  prodcons.h
file  rtld.h
file  rtld_arch.h
file  rtld_debug.h
file  rwlock.h
 This file contains rwlock API and provides its fake implementation based on futexes.
file  setjmp.h
file  smc.c
file  smc.h
file  snprintf.c
file  socket.h
 Socket application program interface (API).
file  socket.h
 Socket messages.
file  socket_client.c
 Socket application program interface (API) implementation.
file  socket_codes.h
 Socket codes and definitions.
file  sort.c
 Sorting functions.
file  sort.h
file  stacktrace.c
file  stacktrace.h
file  stat.h
file  stats.c
file  stats.h
file  stdarg.h
file  stddef.h
file  stdint.h
file  stdio.h
file  stdlib.c
file  stdlib.h
file  str.c
file  str.h
file  str_error.c
file  str_error.h
file  style.h
file  symbol.h
file  syscall.h
 Syscall function declaration for architectures that don't inline syscalls or architectures that handle syscalls according to the number of arguments.
file  syscall.h
file  syscall.h
file  syscall.h
file  syscall.h
file  syscall.h
file  syscall.h
file  sysinfo.c
file  sysinfo.h
file  task.c
file  task.h
file  thread.c
file  thread.h
file  thread.h
file  time.c
file  time.h
file  time.h
file  tl.h
 Transport layer modules messages.
file  tls.c
 Support for thread-local storage, as described in: Drepper U.
file  tls.h
file  trace.h
file  types.h
file  udebug.c
file  udebug.h
file  unistd.h
file  vfs.c
file  vfs.h
file  vprintf.c
file  vsnprintf.c

Modules

 IPC
 HelenOS uspace IPC.

Data Structures

struct  along
struct  amsg_t
struct  async_sess_t
struct  atomic
struct  awaiter_t
 Structures of this type represent a waiting fibril. More...
struct  change_state_t
struct  char_map
 Character string to integer map item. More...
struct  client_t
struct  conn_node_t
 An inactive open connection. More...
struct  connection_t
struct  console_event_t
 Console event structure. More...
struct  device_stats
 Device usage statistics. More...
struct  DIR
struct  dirent
struct  dyn_fifo
 Dynamic first in first out positive integer queue. More...
struct  dyn_info
 Holds the data extracted from an ELF Dynamic section. More...
struct  elf32_dyn
struct  elf32_rel
struct  elf32_rela
struct  fdi_node_t
 This type is a libc version of the VFS triplet. More...
struct  fibril
struct  fibril_condvar_t
struct  fibril_mutex_t
struct  fibril_owner_info_t
struct  fibril_rwlock_t
struct  FILE
struct  hash_table_operations_t
 Set of operations for hash table. More...
struct  hash_table_t
 Hash table structure. More...
struct  heap_area
 Heap area. More...
struct  heap_block_foot_t
 Footer of a heap block. More...
struct  heap_block_head_t
 Header of a heap block. More...
struct  hw_resource_list_t
struct  hw_resource_t
 HW resource (e.g. More...
struct  in6_addr
 INET6 address. More...
struct  in_addr
 INET address. More...
struct  link
 Doubly linked list head and link type. More...
struct  measured_string
 Character string with measured length. More...
struct  module
struct  msg_t
 Structures of this type are used to group information about a call and about a message queue link. More...
struct  packet
 Packet header. More...
struct  packet_dimension
 Packet dimension. More...
struct  printf_spec_t
 Structure for specifying output methods for different printf clones. More...
struct  prodcons_t
struct  runtime_env_t
struct  sockaddr
 Socket address. More...
struct  sockaddr_in
 INET socket address. More...
struct  sockaddr_in6
 INET6 socket address. More...
struct  socket
 Socket specific data. More...
struct  socket_client_globals
 Socket client library global data. More...
struct  stacktrace_t
struct  stat
struct  timeval
struct  timezone
struct  to_event_t
 Structures of this type are used to track the timeout events. More...
struct  token_t
struct  vsnprintf_data_t
struct  wu_event_t
 Structures of this type are used to track the wakeup events. More...

ARP specific message parameters definitions

#define ARP_GET_NETIF(call)   ((services_t) IPC_GET_ARG2(call))
 Return the protocol service message parameter.

ICMP types definitions

#define ICMP_ADDRESS   17
 Address Mask Request.
#define ICMP_ADDRESSREPLY   18
 Address Mask Reply.
#define ICMP_ALTERNATE_ADDR   6
 Alternate Host Address.
#define ICMP_CONVERSION_ERROR   31
 Datagram Conversion Error.
#define ICMP_DEST_UNREACH   3
 Destination Unreachable.
#define ICMP_DN_REPLY   38
 Domain name reply.
#define ICMP_DN_REQUEST   37
 Domain name request.
#define ICMP_ECHO   8
 Echo Request.
#define ICMP_ECHOREPLY   0
 Echo Reply.
#define ICMP_INFO_REPLY   16
 Information Reply.
#define ICMP_INFO_REQUEST   15
 Information Request.
#define ICMP_IPV6_I_AM_HERE   34
 IPv6 I-Am-Here.
#define ICMP_IPV6_WHERE_ARE_YOU   33
 IPv6 Where-Are-You.
#define ICMP_MOBILE_REPLY   36
 Mobile Registration Reply.
#define ICMP_MOBILE_REQUEST   35
 Mobile Registration Request.
#define ICMP_PARAMETERPROB   12
 Parameter Problem.
#define ICMP_PHOTURIS   40
 Photuris.
#define ICMP_REDIRECT   5
 Redirect.
#define ICMP_REDIRECT_MOBILE   32
 Mobile Host Redirect.
#define ICMP_ROUTER_ADV   9
 Router Advertisement.
#define ICMP_ROUTER_SOL   10
 Router solicitation.
#define ICMP_SKIP   39
 SKIP.
#define ICMP_SOURCE_QUENCH   4
 Source Quench.
#define ICMP_TIME_EXCEEDED   11
 Time Exceeded.
#define ICMP_TIMESTAMP   13
 Timestamp Request.
#define ICMP_TIMESTAMPREPLY   14
 Timestamp Reply.
#define ICMP_TRACEROUTE   30
 Traceroute.

ICMP_ALTERNATE_ADDRESS codes definitions

#define ICMP_ALTERNATE_HOST   0
 Alternate address for host.

ICMP_TIME_EXCEEDED codes definitions

#define ICMP_EXC_FRAGTIME   1
 Reassembly TTL exceeded.
#define ICMP_EXC_TTL   0
 Transit TTL exceeded.

ICMP_DEST_UNREACH codes definitions

#define ICMP_FRAG_NEEDED   4
 Fragmentation needed but the Do Not Fragment bit was set.
#define ICMP_HOST_ANO   10
 Destination host administratively prohibited.
#define ICMP_HOST_ISOLATED   8
 Source host isolated (obsolete).
#define ICMP_HOST_UNKNOWN   7
 Destination host unknown.
#define ICMP_HOST_UNR_TOS   12
 Host unreachable for this type of service.
#define ICMP_HOST_UNREACH   1
 Host Unreachable.
#define ICMP_NET_ANO   9
 Destination network administratively prohibited.
#define ICMP_NET_UNKNOWN   6
 Destination network unknown.
#define ICMP_NET_UNR_TOS   11
 Network unreachable for this type of service.
#define ICMP_NET_UNREACH   0
 Network Unreachable.
#define ICMP_PKT_FILTERED   13
 Communication administratively prohibited by filtering.
#define ICMP_PORT_UNREACH   3
 Port Unreachable.
#define ICMP_PREC_CUTOFF   15
 Precedence cutoff in effect.
#define ICMP_PREC_VIOLATION   14
 Host precedence violation.
#define ICMP_PROT_UNREACH   2
 Protocol Unreachable.
#define ICMP_SR_FAILED   5
 Source Route failed.

ICMP specific message parameters definitions

#define ICMP_GET_CODE(call)   ((icmp_code_t) IPC_GET_ARG1(call))
 Return the ICMP code message parameter.
#define ICMP_GET_DONT_FRAGMENT(call)   ((int) IPC_GET_ARG5(call))
 Return the dont fragment message parameter.
#define ICMP_GET_MTU(call)   ((icmp_param_t) IPC_GET_ARG3(call))
 Return the ICMP link MTU message parameter.
#define ICMP_GET_POINTER(call)   ((icmp_param_t) IPC_GET_ARG3(call))
 Return the pointer message parameter.
#define ICMP_GET_SIZE(call)   ((size_t) IPC_GET_ARG1(call))
 Return the size message parameter.
#define ICMP_GET_TIMEOUT(call)   ((suseconds_t) IPC_GET_ARG2(call))
 Return the timeout message parameter.
#define ICMP_GET_TOS(call)   ((ip_tos_t) IPC_GET_ARG4(call))
 Return the type of service message parameter.
#define ICMP_GET_TTL(call)   ((ip_ttl_t) IPC_GET_ARG3(call))
 Return the time to live message parameter.

ICMP_PARAMETERPROB codes definitions

#define ICMP_PARAM_LENGTH   2
 Bad length.
#define ICMP_PARAM_MISSING   1
 Missing required option.
#define ICMP_PARAM_POINTER   0
 Pointer indicates the error.

ICMP_PHOTURIS codes definitions

#define ICMP_PHOTURIS_AUTHENTICATION   1
 Authentication failed.
#define ICMP_PHOTURIS_BAD_SPI   0
 Bad SPI.
#define ICMP_PHOTURIS_DECOMPRESSION   2
 Decompression failed.
#define ICMP_PHOTURIS_DECRYPTION   3
 Decryption failed.
#define ICMP_PHOTURIS_NEED_AUTHENTICATION   4
 Need authentication.
#define ICMP_PHOTURIS_NEED_AUTHORIZATION   5
 Need authorization.

ICMP_REDIRECT codes definitions

#define ICMP_REDIR_HOST   1
 Host redirect.
#define ICMP_REDIR_HOSTTOS   3
 Host redirect for this type of service.
#define ICMP_REDIR_NET   0
 Network redirect (or subnet).
#define ICMP_REDIR_NETTOS   2
 Network redirect for this type of service.

ICMP_ROUTER_ADV codes definitions

#define ICMP_ROUTER_NO_NORMAL_TRAFFIC   16
 Does not route common traffic.
#define ICMP_ROUTER_NORMAL   0
 Normal router advertisement.

Internetwork layer specific message parameters definitions

#define IL_GET_PROTO(call)   ((int) IPC_GET_ARG1(call))
 Return the protocol number message parameter.
#define IL_GET_SERVICE(call)   ((services_t) IPC_GET_ARG2(call))
 Return the registering service message parameter.

IP specific message parameters definitions

#define IP_GET_ADDRESS(call)
 Return the address message parameter.
#define IP_GET_GATEWAY(call)
 Return the gateway message parameter.
#define IP_GET_NETMASK(call)
 Return the network mask message parameter.
#define IP_GET_PROTOCOL(call)   ((ip_protocol_t) IPC_GET_ARG1(call))
 Return the protocol message parameter.
#define IP_SET_HEADERLEN(answer, value)   IPC_SET_ARG2(answer, (sysarg_t) (value))
 Set the header length in the message answer.

IP options definitions

#define IPOPT_CLASS_MASK   0x60
 Class mask.
#define IPOPT_CLASS_SHIFT   5
 Class shift.
#define IPOPT_COPIED(o)   ((o) & IPOPT_COPY)
 Returns a value indicating whether the IP option should be copied.
#define IPOPT_COPY   (1 << IPOPT_COPY_SHIFT)
 Copy flag.
#define IPOPT_COPY_SHIFT   7
 Copy shift.
#define IPOPT_NUMBER_MASK   0x1f
 Number mask.
#define IPOPT_NUMBER_SHIFT   0
 Number shift.
#define IPOPT_TYPE(copy, class, number)
 Returns IP option type.

IP option class definitions

#define IPOPT_CONTROL   (0 << IPOPT_CLASS_SHIFT)
 Control class.

IP option type definitions

#define IPOPT_END   IPOPT_TYPE(0, IPOPT_CONTROL, 0)
 End of list.
#define IPOPT_NOOP   IPOPT_TYPE(0, IPOPT_CONTROL, 1)
 No operation.

IP protocols definitions

#define IPPROTO_ICMP   1
#define IPPROTO_TCP   6
#define IPPROTO_UDP   17

Network interface specific message parameters definitions

#define NETIF_GET_IO(call)   ((void *) IPC_GET_ARG3(call))
 Return the input/output address message parameter.
#define NETIF_GET_IRQ(call)   ((int) IPC_GET_ARG2(call))
 Return the interrupt number message parameter.

Network interface layer specific message parameters definitions

#define NIL_GET_PROTO(call)   ((services_t) IPC_GET_ARG2(call))
 Return the protocol service message parameter.

Protocol families definitions

Same as address families.

#define PF_INET   AF_INET
#define PF_INET6   AF_INET6

Socket specific message parameters definitions

#define SOCKET_GET_ADDRESS_LENGTH(call)
 Returns the address length message parameter.
#define SOCKET_GET_BACKLOG(call)
 Returns the backlog message parameter.
#define SOCKET_GET_DATA_FRAGMENT_SIZE(call)
 Returns the data fragment size message parameter.
#define SOCKET_GET_DATA_FRAGMENTS(call)
 Returns the data fragments message parameter.
#define SOCKET_GET_FLAGS(call)
 Returns the flags message parameter.
#define SOCKET_GET_HEADER_SIZE(call)
 Returns the header size message parameter.
#define SOCKET_GET_NEW_SOCKET_ID(call)
 Returns the new socket identifier message parameter.
#define SOCKET_GET_OPT_LEVEL(call)
 Returns the option level message parameter.
#define SOCKET_GET_OPT_NAME(call)
 Returns the option name message parameter.
#define SOCKET_GET_READ_DATA_LENGTH(call)
 Returns the read data length message parameter.
#define SOCKET_GET_SOCKET_ID(call)
 Returns the socket identifier message parameter.
#define SOCKET_SET_ADDRESS_LENGTH(answer, value)
 Sets the address length in the message answer.
#define SOCKET_SET_DATA_FRAGMENT_SIZE(answer, value)
 Sets the data fragment size in the message answer.
#define SOCKET_SET_HEADER_SIZE(answer, value)
 Sets the header size in the message answer.
#define SOCKET_SET_READ_DATA_LENGTH(answer, value)
 Sets the read data length in the message answer.
#define SOCKET_SET_SOCKET_ID(answer, value)
 Sets the socket identifier in the message answer.

Address families definitions

enum  

Socket application programming interface

int accept (int socket_id, struct sockaddr *cliaddr, socklen_t *addrlen)
 Accepts waiting socket.
int bind (int socket_id, const struct sockaddr *my_addr, socklen_t addrlen)
 Binds the socket to a port address.
int closesocket (int socket_id)
 Closes the socket.
int connect (int socket_id, const struct sockaddr *serv_addr, socklen_t addrlen)
 Connects socket to the remote server.
int getsockopt (int socket_id, int level, int optname, void *value, size_t *optlen)
 Gets socket option.
int listen (int socket_id, int backlog)
 Sets the number of connections waiting to be accepted.
ssize_t recv (int socket_id, void *data, size_t datalength, int flags)
 Receives data via the socket.
ssize_t recvfrom (int socket_id, void *data, size_t datalength, int flags, struct sockaddr *fromaddr, socklen_t *addrlen)
 Receives data via the socket.
int send (int socket_id, void *data, size_t datalength, int flags)
 Sends data via the socket.
int sendto (int socket_id, const void *data, size_t datalength, int flags, const struct sockaddr *toaddr, socklen_t addrlen)
 Sends data via the socket to the remote address.
int setsockopt (int socket_id, int level, int optname, const void *value, size_t optlen)
 Sets socket option.
int socket (int domain, int type, int protocol)
 Creates a new socket.

ICMP module application interface

This interface is used by other application modules.

int icmp_echo_msg (int icmp_phone, size_t size, mseconds_t timeout, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment, const struct sockaddr *addr, socklen_t addrlen)
 Requests an echo message.

Packet management system interface

int pm_add (packet_t *packet)
 Adds the packet mapping.
void pm_destroy (void)
 Releases the packet map.
packet_tpm_find (packet_id_t packet_id)
 Finds the packet mapping.
int pm_init (void)
 Initializes the packet map.
int pq_add (packet_t **first, packet_t *packet, size_t order, size_t metric)
 Add packet to the sorted queue.
packet_tpq_detach (packet_t *packet)
 Detach the packet from the queue.
packet_tpq_find (packet_t *packet, size_t order)
 Finds the packet with the given order.
int pq_get_order (packet_t *packet, size_t *order, size_t *metric)
 Sets the packet order and metric attributes.
int pq_insert_after (packet_t *packet, packet_t *new_packet)
 Inserts packet after the given one.
packet_tpq_next (packet_t *packet)
 Returns the next packet in the queue.
packet_tpq_previous (packet_t *packet)
 Returns the previous packet in the queue.
int pq_set_order (packet_t *packet, size_t order, size_t metric)
 Sets the packet order and metric attributes.

Defines

#define __syscall0   __syscall
#define __SYSCALL0(id)   __syscall0(0, 0, 0, 0, 0, 0, id)
#define __syscall0   __syscall_fast_func
#define __syscall0   __syscall
#define __syscall1   __syscall
#define __SYSCALL1(id, p1)   __syscall1(p1, 0, 0, 0, 0, 0, id)
#define __syscall1   __syscall_fast_func
#define __syscall1   __syscall
#define __syscall2   __syscall
#define __SYSCALL2(id, p1, p2)   __syscall2(p1, p2, 0, 0, 0, 0, id)
#define __syscall2   __syscall_fast_func
#define __syscall2   __syscall
#define __syscall3   __syscall
#define __SYSCALL3(id, p1, p2, p3)   __syscall3(p1, p2, p3, 0, 0, 0, id)
#define __syscall3   __syscall_fast_func
#define __syscall3   __syscall
#define __syscall4   __syscall
#define __SYSCALL4(id, p1, p2, p3, p4)   __syscall4(p1, p2, p3, p4, 0, 0, id)
#define __syscall4   __syscall_fast_func
#define __syscall4   __syscall
#define __syscall5   __syscall
#define __SYSCALL5(id, p1, p2, p3, p4, p5)   __syscall5(p1, p2, p3, p4, p5, 0, id)
#define __syscall5   __syscall_slow
#define __syscall5   __syscall
#define __syscall6   __syscall
#define __SYSCALL6(id, p1, p2, p3, p4, p5, p6)   __syscall6(p1, p2, p3, p4, p5, p6, id)
#define __syscall6   __syscall_slow
#define __syscall6   __syscall
#define ALIGN_DOWN(s, a)   ((s) & ~((a) - 1))
 Align to the nearest lower address which is a power of two.
#define ALIGN_UP(s, a)   ((long)((s) + ((a) - 1)) & ~((long) (a) - 1))
 Align to the nearest higher address which is a power of two.
#define AOFF64_MAX   UINT64_MAX
#define AOFF64_MIN   UINT64_MIN
#define AREA_FIRST_BLOCK_HEAD(area)   (ALIGN_UP(((uintptr_t) (area)) + sizeof(heap_area_t), BASE_ALIGN))
 Get first block in heap area.
#define AREA_LAST_BLOCK_FOOT(area)   (((uintptr_t) (area)->end) - sizeof(heap_block_foot_t))
 Get last block in heap area.
#define AREA_OVERHEAD(size)   (ALIGN_UP(size + sizeof(heap_area_t), BASE_ALIGN))
 Overhead of each area.
#define ARP_GET_PROTO(call)   ((services_t) IPC_GET_ARG2(call))
 Return the protocol service message parameter.
#define assert(expr)
 Debugging assert macro.
#define async_data_read_forward_0_0(phoneid, method, answer)   async_data_read_forward_fast((phoneid), (method), 0, 0, 0, 0, NULL)
#define async_data_read_forward_0_1(phoneid, method, answer)   async_data_read_forward_fast((phoneid), (method), 0, 0, 0, 0, (answer))
#define async_data_read_forward_1_0(phoneid, method, arg1, answer)   async_data_read_forward_fast((phoneid), (method), (arg1), 0, 0, 0, NULL)
#define async_data_read_forward_1_1(phoneid, method, arg1, answer)   async_data_read_forward_fast((phoneid), (method), (arg1), 0, 0, 0, (answer))
#define async_data_read_forward_2_0(phoneid, method, arg1, arg2, answer)   async_data_read_forward_fast((phoneid), (method), (arg1), (arg2), 0, 0, NULL)
#define async_data_read_forward_2_1(phoneid, method, arg1, arg2, answer)
#define async_data_read_forward_3_0(phoneid, method, arg1, arg2, arg3, answer)
#define async_data_read_forward_3_1(phoneid, method, arg1, arg2, arg3, answer)
#define async_data_read_forward_4_0(phoneid, method, arg1, arg2, arg3, arg4, answer)
#define async_data_read_forward_4_1(phoneid, method, arg1, arg2, arg3, arg4, answer)
#define async_data_read_start(p, buf, len)   async_data_read_start_generic((p), (buf), (len), IPC_XF_NONE)
#define async_data_write_forward_0_0(phoneid, method, answer)   async_data_write_forward_fast((phoneid), (method), 0, 0, 0, 0, NULL)
#define async_data_write_forward_0_1(phoneid, method, answer)   async_data_write_forward_fast((phoneid), (method), 0, 0, 0, 0, (answer))
#define async_data_write_forward_1_0(phoneid, method, arg1, answer)   async_data_write_forward_fast((phoneid), (method), (arg1), 0, 0, 0, NULL)
#define async_data_write_forward_1_1(phoneid, method, arg1, answer)
#define async_data_write_forward_2_0(phoneid, method, arg1, arg2, answer)
#define async_data_write_forward_2_1(phoneid, method, arg1, arg2, answer)
#define async_data_write_forward_3_0(phoneid, method, arg1, arg2, arg3, answer)
#define async_data_write_forward_3_1(phoneid, method, arg1, arg2, arg3, answer)
#define async_data_write_forward_4_0(phoneid, method, arg1, arg2, arg3, arg4, answer)
#define async_data_write_forward_4_1(phoneid, method, arg1, arg2, arg3, arg4, answer)
#define async_data_write_start(p, buf, len)   async_data_write_start_generic((p), (buf), (len), IPC_XF_NONE)
#define async_get_call(data)   async_get_call_timeout(data, 0)
#define async_manager()   fibril_switch(FIBRIL_TO_MANAGER)
#define async_req_0_0(phoneid, method)
#define async_req_0_1(phoneid, method, r1)
#define async_req_0_2(phoneid, method, r1, r2)
#define async_req_0_3(phoneid, method, r1, r2, r3)
#define async_req_0_4(phoneid, method, r1, r2, r3, r4)
#define async_req_0_5(phoneid, method, r1, r2, r3, r4, r5)
#define async_req_1_0(phoneid, method, arg1)
#define async_req_1_1(phoneid, method, arg1, rc1)
#define async_req_1_2(phoneid, method, arg1, rc1, rc2)
#define async_req_1_3(phoneid, method, arg1, rc1, rc2, rc3)
#define async_req_1_4(phoneid, method, arg1, rc1, rc2, rc3, rc4)
#define async_req_1_5(phoneid, method, arg1, rc1, rc2, rc3, rc4, rc5)
#define async_req_2_0(phoneid, method, arg1, arg2)
#define async_req_2_1(phoneid, method, arg1, arg2, rc1)
#define async_req_2_2(phoneid, method, arg1, arg2, rc1, rc2)
#define async_req_2_3(phoneid, method, arg1, arg2, rc1, rc2, rc3)
#define async_req_2_4(phoneid, method, arg1, arg2, rc1, rc2, rc3, rc4)
#define async_req_2_5(phoneid, method, arg1, arg2, rc1, rc2, rc3, rc4, rc5)
#define async_req_3_0(phoneid, method, arg1, arg2, arg3)
#define async_req_3_1(phoneid, method, arg1, arg2, arg3, rc1)
#define async_req_3_2(phoneid, method, arg1, arg2, arg3, rc1, rc2)
#define async_req_3_3(phoneid, method, arg1, arg2, arg3, rc1, rc2, rc3)
#define async_req_3_4(phoneid, method, arg1, arg2, arg3, rc1, rc2, rc3, rc4)
#define async_req_3_5(phoneid, method, arg1, arg2, arg3, rc1, rc2, rc3, rc4, rc5)
#define async_req_4_0(phoneid, method, arg1, arg2, arg3, arg4)
#define async_req_4_1(phoneid, method, arg1, arg2, arg3, arg4, rc1)
#define async_req_4_2(phoneid, method, arg1, arg2, arg3, arg4, rc1, rc2)
#define async_req_4_3(phoneid, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3)
#define async_req_4_4(phoneid, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, rc4)
#define async_req_4_5(phoneid, method, arg1, arg2, arg3, arg4, rc1, rc2, rc3, rc4, rc5)
#define async_req_5_0(phoneid, method, arg1, arg2, arg3, arg4, arg5)
#define async_req_5_1(phoneid, method, arg1, arg2, arg3, arg4, arg5, rc1)
#define async_req_5_2(phoneid, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2)
#define async_req_5_3(phoneid, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, rc3)
#define async_req_5_4(phoneid, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, rc3, rc4)
#define async_req_5_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, rc1, rc2, rc3, rc4, rc5)
#define async_send_0(phoneid, method, dataptr)   async_send_fast((phoneid), (method), 0, 0, 0, 0, (dataptr))
#define async_send_1(phoneid, method, arg1, dataptr)   async_send_fast((phoneid), (method), (arg1), 0, 0, 0, (dataptr))
#define async_send_2(phoneid, method, arg1, arg2, dataptr)   async_send_fast((phoneid), (method), (arg1), (arg2), 0, 0, (dataptr))
#define async_send_3(phoneid, method, arg1, arg2, arg3, dataptr)   async_send_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, (dataptr))
#define async_send_4(phoneid, method, arg1, arg2, arg3, arg4, dataptr)
#define async_send_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, dataptr)
#define async_share_in_start_0_0(phoneid, dst, size)   async_share_in_start((phoneid), (dst), (size), 0, NULL)
#define async_share_in_start_0_1(phoneid, dst, size, flags)   async_share_in_start((phoneid), (dst), (size), 0, (flags))
#define async_share_in_start_1_0(phoneid, dst, size, arg)   async_share_in_start((phoneid), (dst), (size), (arg), NULL)
#define async_share_in_start_1_1(phoneid, dst, size, arg, flags)   async_share_in_start((phoneid), (dst), (size), (arg), (flags))
#define BASE_ALIGN   16
 Allocation alignment.
#define BLOCK_FOOT(head)
 Get footer in heap block.
#define BLOCK_HEAD(foot)
 Get header in heap block.
#define BUFSIZ   4096
 Default size for stream I/O buffers.
#define bzero(ptr, len)   memset((ptr), 0, (len))
#define CHAR_MAP_MAGIC_VALUE   0x12345611
 Internal magic value for a consistency check.
#define CHAR_MAP_NULL   (-1)
 Invalid assigned value used also if an entry does not exist.
#define CLIENT_HASH_TABLE_BUCKETS   32
#define CONN_HASH_TABLE_BUCKETS   32
#define CONT_BITS   6
 Number of data bits in a UTF-8 continuation byte.
#define context_set_generic(c, _pc, stack, size, ptls)
#define DEBUG(fmt,)
#define DECLARE_GCD(type, name)
#define DECLARE_LCM(type, name, gcd)
#define DEVICE_INVALID_ID   (-1)
 Invalid device identifier.
#define DEVICE_MAP_DECLARE   INT_MAP_DECLARE
 Device identifier to generic type map declaration.
#define DEVICE_MAP_IMPLEMENT   INT_MAP_IMPLEMENT
 Device identifier to generic type map implementation.
#define DPRINTF(format,)   if (0) printf(format, ##__VA_ARGS__)
#define DST_NONE   0
#define DT_BIND_NOW   24
#define DT_DEBUG   21
#define DT_FINI   13
#define DT_HASH   4
#define DT_HIPROC   0x7fffffff
#define DT_INIT   12
#define DT_JMPREL   23
#define DT_LOPROC   0x70000000
#define DT_NEEDED   1
#define DT_NULL   0
#define DT_PLTGOT   3
#define DT_PLTREL   20
#define DT_PLTRELSZ   2
#define DT_REL   17
#define DT_RELA   7
#define DT_RELAENT   9
#define DT_RELASZ   8
#define DT_RELENT   19
#define DT_RELSZ   18
#define DT_RPATH   15
#define DT_SONAME   14
#define DT_STRSZ   10
#define DT_STRTAB   5
#define DT_SYMBOLIC   16
#define DT_SYMENT   11
#define DT_SYMTAB   6
#define DT_TEXTREL   22
#define DTOR_T(identifier)   void (*identifier)(const void *)
 Generic destructor function pointer.
#define DTOR_T(identifier)   void (*identifier)(const void *)
 Generic destructor function pointer.
#define DTOR_T(identifier)   void (*identifier)(const void *)
 Generic destructor function pointer.
#define DYN_FIFO_MAGIC_VALUE   0x58627659
 Internal magic value for a consistency check.
#define EADDRINUSE   (-10048)
 Address is already in use.
#define EAFNOSUPPORT   (-10047)
 Address family is not supported.
#define EAGAIN   (-11002)
 The requested operation was not performed.
#define EBADCHECKSUM   (-300)
 Bad checksum.
#define EBADF   (-262)
#define EDESTADDRREQ   (-10039)
 The destination address required.
#define EEMPTY   (-302)
 Empty resource (no data).
#define EEXIST   (-260)
#define EINPROGRESS   (-10036)
 An API function is called while another blocking function is in progress.
#define EIO   (-265)
#define EISDIR   (-257)
#define ELF32_R_SYM(i)   ((i)>>8)
#define ELF32_R_TYPE(i)   ((unsigned char)(i))
#define EMFILE   (-18)
#define EMLINK   (-266)
#define ENAK   (-303)
 Negative acknowledgment.
#define ENAMETOOLONG   (-256)
#define ENOSPC   (-259)
#define ENOTCONN   (-10057)
 The socket is not connected or bound.
#define ENOTDIR   (-258)
#define ENOTEMPTY   (-261)
#define ENOTSOCK   (-10038)
 The socket identifier is not valid.
#define EOF   (-1)
#define EPFNOSUPPORT   (-10046)
 Protocol family is not supported.
#define EPROTONOSUPPORT   (-10043)
 Protocol is not supported.
#define ERANGE   (-263)
#define errno   (*(__errno()))
#define errx(status, fmt,)
#define ESOCKTNOSUPPORT   (-10044)
 Socket type is not supported.
#define ESTALL   (-301)
 USB: stalled operation.
#define EXDEV   (-264)
#define false   0
#define FIBRIL_CONDVAR_INITIALIZE(name)   fibril_condvar_t name = FIBRIL_CONDVAR_INITIALIZER(name)
#define FIBRIL_CONDVAR_INITIALIZER(name)
#define FIBRIL_INITIAL_STACK_PAGES_NO   1
#define fibril_local   __thread
 Fibril-local variable specifier.
#define FIBRIL_MUTEX_INITIALIZE(name)   fibril_mutex_t name = FIBRIL_MUTEX_INITIALIZER(name)
#define FIBRIL_MUTEX_INITIALIZER(name)
#define FIBRIL_RWLOCK_INITIALIZE(name)   fibril_rwlock_t name = FIBRIL_RWLOCK_INITIALIZER(name)
#define FIBRIL_RWLOCK_INITIALIZER(name)
#define FIBRIL_SERIALIZED   1
#define FIBRIL_WRITER   2
#define fifo_create(name)   name.fifo = malloc(sizeof(*name.fifo) * name.items)
 Allocate memory for dynamic FIFO.
#define FIFO_CREATE_STATIC(name, t, itms)
#define FIFO_INITIALIZE_DYNAMIC(name, t, itms)
 Create and prepare dynamic FIFO.
#define FIFO_INITIALIZE_STATIC(name, t, itms)
 Create and initialize static FIFO.
#define fifo_pop(name)   name.fifo[name.head = (name.head + 1) < name.items ? (name.head + 1) : 0]
 Pop value from head of FIFO.
#define fifo_push(name, value)   name.fifo[name.tail = (name.tail + 1) < name.items ? (name.tail + 1) : 0] = (value)
 Push value to tail of FIFO.
#define FUTEX_INITIALIZER   {1}
#define GENERIC_CHAR_MAP_DECLARE(name, type)
 Character string to generic type map declaration.
#define GENERIC_CHAR_MAP_IMPLEMENT(name, type)
 Character string to generic type map implementation.
#define GENERIC_CHAR_MAP_MAGIC_VALUE   0x12345622
 Internal magic value for a map consistency check.
#define GENERIC_FIELD_DECLARE(name, type)
 Generic type field declaration.
#define GENERIC_FIELD_IMPLEMENT(name, type)
 Generic type field implementation.
#define GENERIC_FIELD_MAGIC_VALUE   0x55667788
 Internal magic value for a field consistency check.
#define getpagesize()   (PAGE_SIZE)
#define GROSS_SIZE(size)   ((size) + STRUCT_OVERHEAD)
 Calculate real size of a heap block.
#define hash_table_get_instance(item, type, member)   list_get_instance((item), type, member)
#define HEAP_AREA_MAGIC   UINT32_C(0xBEEFCAFE)
 Magic used in heap descriptor.
#define HEAP_BLOCK_FOOT_MAGIC   UINT32_C(0xBEEF0202)
 Magic used in heap footers.
#define HEAP_BLOCK_HEAD_MAGIC   UINT32_C(0xBEEF0101)
 Magic used in heap headers.
#define HI_MASK_8(n)   (~LO_MASK_8(8 - (n)))
 Byte mask consisting of highest
bits (out of 8).
#define host2uint16_t_be(n)   (uint16_t_byteorder_swap(n))
#define host2uint16_t_le(n)   (n)
#define host2uint32_t_be(n)   (uint32_t_byteorder_swap(n))
#define host2uint32_t_le(n)   (n)
#define host2uint64_t_be(n)   (uint64_t_byteorder_swap(n))
#define host2uint64_t_le(n)   (n)
#define htonl(n)   host2uint32_t_be((n))
#define htons(n)   host2uint16_t_be((n))
#define IBUF_SIZE   32
 Immediate buffer size.
#define ICMP_CONNECT_TIMEOUT   1000000
 Default timeout for incoming connections in microseconds (1 sec).
#define INDEX(buf, i, elem_size)   ((buf) + (i) * (elem_size))
 Array accessor.
#define INET6_ADDRSTRLEN   (8 * 4 + 7 + 1)
 INET6 string address maximum length.
#define INET_ADDRSTRLEN   (4 * 3 + 3 + 1)
 INET string address maximum length.
#define INT16_MAX   INT16_C(0x7FFF)
#define INT16_MIN   INT16_C(0x8000)
#define INT32_MAX   INT32_C(0x7FFFFFFF)
#define INT32_MIN   INT32_C(0x80000000)
#define INT64_MAX   INT64_C(0x7FFFFFFFFFFFFFFF)
#define INT64_MIN   INT64_C(0x8000000000000000)
#define INT8_MAX   INT8_C(0x7F)
#define INT8_MIN   INT8_C(0x80)
#define INT_MAP_DECLARE(name, type)
 Integer to generic type map declaration.
#define INT_MAP_IMPLEMENT(name, type)
 Integer to generic type map implementation.
#define INT_MAP_ITEM_MAGIC_VALUE   0x55667788
 Internal magic value for an item consistency check.
#define INT_MAP_MAGIC_VALUE   0x11223344
 Internal magic value for a map consistency check.
#define IPC_GET_ADDR_LEN(call)   ((size_t) IPC_GET_ARG2(call))
 Return the maximal address length message parameter.
#define IPC_GET_CONTENT(call)   ((size_t) IPC_GET_ARG1(call))
 Return the maximal content length message parameter.
#define IPC_GET_ID(call)   ((packet_id_t) IPC_GET_ARG1(call))
 Return the packet identifier message parameter.
#define IPC_GET_PREFIX(call)   ((size_t) IPC_GET_ARG3(call))
 Return the maximal prefix length message parameter.
#define IPC_GET_SUFFIX(call)   ((size_t) IPC_GET_ARG4(call))
 Return the maximal suffix length message parameter.
#define IPDEFTTL   64
 Default time to live counter.
#define IPVERSION   4
 Default IPVERSION.
#define KiB2SIZE(kb)   ((kb) << 10)
#define LIBARCH_SYSCALL_GENERIC
#define LIBARCH_SYSCALL_GENERIC
#define LIBARCH_SYSCALL_GENERIC
#define LIBARCH_SYSCALL_GENERIC
#define LIBC_ASYNC_C_
 Asynchronous library.
#define list_foreach(list, iterator)
#define list_get_instance(link, type, member)   ((type *) (((void *)(link)) - ((void *) &(((type *) NULL)->member))))
#define LIST_INITIALIZE(name)
 Declare and initialize statically allocated list.
#define LO_MASK_32(n)   ((uint32_t) ((1 << (n)) - 1))
 Byte mask consisting of lowest
bits (out of 32).
#define LO_MASK_8(n)   ((uint8_t) ((1 << (n)) - 1))
 Byte mask consisting of lowest
bits (out of 8).
#define LOWER32(arg)   (((uint64_t) (arg)) & 0xffffffff)
#define malloc_assert(expr)
#define MAP_ANONYMOUS   (1 << 3)
#define MAP_FAILED   ((void *) -1)
#define MAP_FIXED   (1 << 2)
#define MAP_PRIVATE   (1 << 1)
#define MAP_SHARED   (1 << 0)
#define max(a, b)   ((a) > (b) ? (a) : (b))
#define MERGE_LOUP32(lo, up)
#define MiB2SIZE(mb)   ((mb) << 20)
#define min(a, b)   ((a) < (b) ? (a) : (b))
#define MIN_ERRNO   -17
#define MODULE_WAIT_TIME   (10 * 1000)
 The time between connect requests in microseconds.
#define NAME_MAX   256
#define NET_SIZE(size)   ((size) - STRUCT_OVERHEAD)
 Calculate net size of a heap block.
#define NEXT_INDEX(fifo, index)   (((index) + 1) % ((fifo)->size + 1))
 Returns the next queue index.
#define NO_DATA   (-11004)
 No data.
#define NO_TRACE   __attribute__((no_instrument_function))
#define NOERR_LEN   64
#define ntohl(n)   uint32_t_be2host((n))
#define ntohs(n)   uint16_t_be2host((n))
#define NULL   ((void *) 0)
#define O_APPEND   8
#define O_CREAT   1
#define O_DESC   128
#define O_EXCL   2
#define O_RDONLY   16
#define O_RDWR   32
#define O_TRUNC   4
#define O_WRONLY   64
#define OFF64_MAX   INT64_MAX
#define OFF64_MIN   INT64_MIN
#define PACKET_DATA_LENGTH(header)   ((header)->data_end - (header)->data_start)
 Returns the actual packet data length.
#define PACKET_MAGIC_VALUE   0x11227788
 Packet integrity check magic value.
#define PACKET_MAP_INDEX(packet_id)   (((packet_id) - 1) % PACKET_MAP_SIZE)
 Returns the packet index in the corresponding packet map page.
#define PACKET_MAP_PAGE(packet_id)   (((packet_id) - 1) / PACKET_MAP_SIZE)
 Returns the packet map page index.
#define PACKET_MAP_SIZE   100
 Packet map page size.
#define PACKET_MAX_ADDRESS_LENGTH(header)   ((header)->dest_addr - (header)->src_addr)
 Returns the maximum packet address length.
#define PACKET_MIN_SUFFIX(header)   ((header)->length - (header)->data_start - (header)->max_content)
 Returns the minimum packet suffix.
#define PRIdOFF64   PRId64
#define PRINTF_ATTRIBUTE(start, end)   __attribute__((format(gnu_printf, start, end)))
#define PRIuOFF64   PRIu64
#define PRIXOFF64   PRIX64
#define PRIxOFF64   PRIx64
#define PROTO_EXEC   AS_AREA_EXEC
#define PROTO_READ   AS_AREA_READ
#define PROTO_WRITE   AS_AREA_WRITE
#define rand()   random()
#define RAND_MAX   714025
#define ROUND_UP(n, b)   (((n) / (b) + ((n) % (b) != 0)) * (b))
 Round up to the nearest higher boundary.
#define rwlock_initialize(rwlock)   futex_initialize((rwlock), 1)
#define RWLOCK_INITIALIZE(rwlock)   rwlock_t rwlock = FUTEX_INITIALIZER
#define rwlock_read_lock(rwlock)   futex_down((rwlock))
#define rwlock_read_unlock(rwlock)   futex_up((rwlock))
#define rwlock_write_lock(rwlock)   futex_down((rwlock))
#define rwlock_write_unlock(rwlock)   futex_up((rwlock))
#define SEEK_CUR   1
#define SEEK_CUR   1
#define SEEK_END   2
#define SEEK_END   2
#define SEEK_SET   0
#define SEEK_SET   0
#define SHN_ABS   0xfff1
#define SHN_COMMON   0xfff2
#define SHN_HIPROC   0xff1f
#define SHN_HIRESERVE   0xffff
#define SHN_LOPROC   0xff00
#define SHN_LORESERVE   0xff00
#define SHN_UNDEF   0
#define SHRINK_GRANULARITY   (64 * PAGE_SIZE)
 Heap shrink granularity.
#define SOCKET_CONNECT_TIMEOUT   (1 * 1000 * 1000)
 Default timeout for connections in microseconds.
#define SOCKET_ID_TRIES   100
 Maximum number of random attempts to find a new socket identifier before switching to the sequence.
#define SOCKET_INITIAL_ACCEPTED_SIZE   1
 Initial waiting sockets queue size.
#define SOCKET_INITIAL_RECEIVED_SIZE   4
 Initial received packet queue size.
#define SOCKET_MAX_ACCEPTED_SIZE   0
 Maximum waiting sockets queue size.
#define SOCKET_MAX_RECEIVED_SIZE   0
 Maximum received packet queue size.
#define srand(seed)   srandom(seed)
#define STN_UNDEF   0
#define STR_BOUNDS(length)   ((length) << 2)
 Maximum size of a string containing length characters.
#define STR_NO_LIMIT   ((size_t) -1)
 No size limit constant.
#define STRING(arg)   STRING_ARG(arg)
#define STRING_ARG(arg)   #arg
#define STRUCT_OVERHEAD   (sizeof(heap_block_head_t) + sizeof(heap_block_foot_t))
 Overhead of each heap block.
#define SYSINFO_STATS_MAX_PATH   64
#define THREAD_INITIAL_STACK_PAGES_NO   2
#define true   1
#define U_SPECIAL   '?'
#define UINT16_MAX   UINT16_C(0xFFFF)
#define UINT16_MIN   UINT16_C(0)
#define uint16_t_be2host(n)   (uint16_t_byteorder_swap(n))
#define uint16_t_le2host(n)   (n)
#define UINT32_MAX   UINT32_C(0xFFFFFFFF)
#define UINT32_MIN   UINT32_C(0)
#define uint32_t_be2host(n)   (uint32_t_byteorder_swap(n))
#define uint32_t_le2host(n)   (n)
#define UINT64_MAX   UINT64_C(0xFFFFFFFFFFFFFFFF)
#define UINT64_MIN   UINT64_C(0)
#define uint64_t_be2host(n)   (uint64_t_byteorder_swap(n))
#define uint64_t_le2host(n)   (n)
#define UINT8_MAX   UINT8_C(0xFF)
#define UINT8_MIN   UINT8_C(0)
#define UNKNOWN_LOCALE_LEN   64
#define UPPER32(arg)   (((((uint64_t) arg)) >> 32) & 0xffffffff)
#define va_arg(ap, type)   __builtin_va_arg(ap, type)
#define va_end(ap)   __builtin_va_end(ap)
#define va_start(ap, last)   __builtin_va_start(ap, last)

Typedefs

typedef addrinfo addrinfo_t
 Type definition of the address information.
typedef ipc_callid_t aid_t
typedef uint64_t aoff64_t
 Absolute offset.
typedef int(*) arg_parser (const char *, int *)
typedef void(*) async_client_conn_t (ipc_callid_t, ipc_call_t *)
typedef void *(*) async_client_data_ctor_t (void)
typedef void(*) async_client_data_dtor_t (void *)
typedef uint8_t bool
typedef char_map char_map_t
 Type definition of the character string to integer map.
typedef int connect_module_t (services_t need)
 Connect to the needed module function type definition.
typedef int device_id_t
 Device identifier type.
typedef enum device_state device_state_t
 Device state type.
typedef device_stats device_stats_t
 Type definition of the device usage statistics.
typedef dyn_fifo dyn_fifo_t
 Type definition of the dynamic fifo queue.
typedef dyn_info dyn_info_t
 Holds the data extracted from an ELF Dynamic section.
typedef sysarg_t fid_t
typedef unsigned long fifo_count_t
typedef unsigned long fifo_index_t
typedef atomic_t futex_t
typedef unsigned long hash_count_t
typedef unsigned long hash_index_t
typedef heap_area heap_area_t
 Heap area.
typedef uint8_t icmp_code_t
 ICMP code type definition.
typedef uint16_t icmp_param_t
 ICMP parameter type definition.
typedef uint8_t icmp_type_t
 ICMP type type definition.
typedef in6_addr in6_addr_t
 Type definition of the INET6 address.
typedef in_addr in_addr_t
 Type definition of the INET address.
typedef volatile uint16_t ioport16_t
typedef volatile uint32_t ioport32_t
typedef volatile uint8_t ioport8_t
typedef uint8_t ip_protocol_t
 IP transport protocol type definition.
typedef uint8_t ip_tos_t
 IP type of service type definition.
typedef uint8_t ip_ttl_t
 IP time to live counter type definition.
typedef context_t jmp_buf
typedef link link_t
 Doubly linked list head and link type.
typedef measured_string measured_string_t
 Type definition of the character string with measured length.
typedef unsigned int mode_t
typedef uint32_t mseconds_t
typedef int64_t off64_t
 Relative offset.
typedef packet_dimension packet_dimension_t
 Type definition of the packet dimension.
typedef int packet_id_t
 Packet identifier type.
typedef packet_tpacket_map_t [PACKET_MAP_SIZE]
 Type definition of the packet map page.
typedef packet packet_t
 Type definition of the packet.
typedef atomic_t rwlock_t
typedef enum sock_type sock_type_t
 Socket types.
typedef sockaddr_in6 sockaddr_in6_t
 Type definition of the INET6 socket address.
typedef sockaddr_in sockaddr_in_t
 Type definition of the INET socket address.
typedef sockaddr sockaddr_t
 Type definition of the socket address.
typedef socket socket_t
 Type definition of the socket specific data.
typedef int32_t socklen_t
 Type definition of the socket length.
typedef int(*) sort_cmp_t (void *, void *, void *)
typedef long suseconds_t
typedef uint64_t task_id_t
typedef sysarg_t thash_t
typedef uint64_t thread_id_t
typedef long time_t
typedef uint32_t useconds_t
typedef __builtin_va_list va_list

Enumerations

enum  _buffer_state { _bs_empty, _bs_write, _bs_read }
enum  _buffer_type { _IONBF, _IOLBF, _IOFBF }
enum  arp_messages {
  NET_ARP_CLEAN_CACHE = NET_ARP_FIRST, NET_ARP_CLEAR_ADDRESS, NET_ARP_CLEAR_DEVICE, NET_ARP_DEVICE,
  NET_ARP_TRANSLATE
}
 ARP module messages. More...
enum  char_dev_method_t
enum  console_caps_t
enum  console_color_t
enum  console_ev_type_t
enum  console_style_t
enum  device_state { NETIF_NULL = 0, NETIF_STOPPED, NETIF_ACTIVE, NETIF_CARRIER_LOST }
 Device state. More...
enum  endianness_t
enum  fibril_switch_type_t
enum  hw_res_method_t
 HW resource provider interface.
enum  hw_res_type_t
 HW resource types.
enum  icmp_messages_t {
  NET_ICMP_ECHO = NET_ICMP_FIRST, NET_ICMP_DEST_UNREACH, NET_ICMP_SOURCE_QUENCH, NET_ICMP_TIME_EXCEEDED,
  NET_ICMP_PARAMETERPROB
}
 ICMP module messages. More...
enum  il_messages { NET_IL_DEVICE_STATE = NET_IL_FIRST, NET_IL_MTU_CHANGED, NET_IL_RECEIVED }
 Internet layer modules messages. More...
enum  ip_messages {
  NET_IP_DEVICE = NET_IP_FIRST, NET_IP_ADD_ROUTE, NET_IP_GET_ROUTE, NET_IP_RECEIVED_ERROR,
  NET_IP_SET_GATEWAY, NET_IP_PACKET_SPACE, NET_IP_SEND
}
 IP module messages. More...
enum  keycode_t
 Keycode definitions. More...
enum  keymod_t
enum  l18_win_locales_t
 Windows locale IDs. More...
enum  log_level_t { , LVL_LIMIT }
enum  net_messages { NET_NET_GET_CONF = NET_FIRST, NET_NET_GET_DEVICE_CONF, NET_NET_STARTUP }
 Networking subsystem central module messages. More...
enum  netif_messages {
  NET_NETIF_PROBE = NET_NETIF_FIRST, NET_NETIF_SEND, NET_NETIF_START, NET_NETIF_STATS,
  NET_NETIF_STOP, NET_NETIF_GET_ADDR
}
 Network interface common module messages. More...
enum  nil_messages {
  NET_NIL_DEVICE = NET_NIL_FIRST, NET_NIL_DEVICE_STATE, NET_NIL_RECEIVED, NET_NIL_SEND,
  NET_NIL_PACKET_SPACE, NET_NIL_ADDR, NET_NIL_BROADCAST_ADDR
}
 Network interface layer module messages. More...
enum  packet_messages {
  NET_PACKET_CREATE_1 = NET_PACKET_FIRST, NET_PACKET_CREATE_4, NET_PACKET_GET, NET_PACKET_GET_SIZE,
  NET_PACKET_RELEASE
}
 Packet server module messages. More...
enum  sock_type { SOCK_STREAM = 1, SOCK_DGRAM = 2, SOCK_RAW = 3 }
 Socket types. More...
enum  socket_messages {
  NET_SOCKET = NET_SOCKET_FIRST, NET_SOCKET_BIND, NET_SOCKET_LISTEN, NET_SOCKET_ACCEPT,
  NET_SOCKET_CONNECT, NET_SOCKET_CLOSE, NET_SOCKET_SEND, NET_SOCKET_SENDTO,
  NET_SOCKET_RECV, NET_SOCKET_RECVFROM, NET_SOCKET_GETSOCKOPT, NET_SOCKET_SETSOCKOPT,
  NET_SOCKET_ACCEPTED, NET_SOCKET_RECEIVED, NET_SOCKET_DATA_FRAGMENT_SIZE
}
 Socket client messages. More...
enum  state_t
 States used by canonify().
enum  sysinfo_item_tag_t
 Sysinfo value types.
enum  task_exit_t
enum  tl_messages { NET_TL_RECEIVED = NET_TL_FIRST }
 Transport layer modules messages. More...
enum  tokval_t
 Token types used for tokenization of path.

Functions

tcb_t__alloc_tls (void **, size_t)
void __async_init (void)
 Initialize the async framework.
void __async_sess_init (void)
 Initialize the async_sess subsystem.
void __entry (void)
int * __errno (void)
void __free_tls (tcb_t *tcb)
void __free_tls_arch (tcb_t *, size_t)
void __main (void *pcb_ptr)
tcb_t__make_tls (void)
 Create TLS (Thread Local Storage) data structures.
void __malloc_init (void)
 Initialize the heap allocator.
void __stdio_done (void)
void __stdio_init (int filc, fdi_node_t *filv[])
sysarg_t __syscall (const sysarg_t, const sysarg_t, const sysarg_t, const sysarg_t, const sysarg_t, const sysarg_t, const syscall_t)
 Syscall routine.
void __thread_entry (void)
void __thread_main (uspace_arg_t *uarg)
 Main thread function.
static int _fallocbuf (FILE *stream)
 Allocate stream buffer.
static void _ffillbuf (FILE *stream)
 Read some data in stream buffer.
static void _fflushbuf (FILE *stream)
 Write out stream buffer, do not sync stream.
static void _fibril_condvar_wakeup_common (fibril_condvar_t *fcv, bool once)
static void _fibril_mutex_unlock_unsafe (fibril_mutex_t *fm)
static void _fibril_rwlock_common_unlock (fibril_rwlock_t *frw)
static size_t _fread (void *buf, size_t size, size_t nmemb, FILE *stream)
 Read from a stream (unbuffered).
static size_t _fwrite (const void *buf, size_t size, size_t nmemb, FILE *stream)
 Write to a stream (unbuffered).
static void _gsort (void *data, size_t cnt, size_t elem_size, sort_cmp_t cmp, void *arg, void *slot)
 Gnome sort.
static void _qsort (void *data, size_t cnt, size_t elem_size, sort_cmp_t cmp, void *arg, void *slot, void *pivot)
 Quicksort.
static void _setvbuf (FILE *stream)
static unsigned long _strtoul (const char *nptr, char **endptr, int base, char *sgn)
 Convert string to a number.
static int _unlink (const char *path, int lflag)
void abort (void)
char * absolutize (const char *path, size_t *retlen)
void answer_call (ipc_callid_t callid, int result, ipc_call_t *answer, size_t count)
 Answer a call.
static void area_check (void *addr)
 Check a heap area structure.
static bool area_create (size_t size)
 Create new heap area.
static bool area_grow (heap_area_t *area, size_t size)
 Try to enlarge a heap area.
int arg_parse_short_long (const char *, const char *, const char *)
int arg_parse_string (int, char **, int *, char **, int)
 Parse the next argument as a character string.
int as_area_change_flags (void *address, unsigned int flags)
 Change address-space area flags.
void * as_area_create (void *address, size_t size, unsigned int flags)
 Create address space area.
int as_area_destroy (void *address)
 Destroy address space area.
int as_area_resize (void *address, size_t size, unsigned int flags)
 Resize address space area.
void * as_get_mappable_page (size_t size)
 Return pointer to unmapped address space area.
int as_get_physical_mapping (void *address, uintptr_t *frame)
 Find mapping to physical address.
bool ascii_check (wchar_t ch)
 Check whether character is plain ASCII.
int asprintf (char **strp, const char *fmt,...)
 Allocate and print to string.
static int asprintf_str_write (const char *str, size_t count, void *unused)
static int asprintf_wstr_write (const wchar_t *str, size_t count, void *unused)
void assert_abort (const char *cond, const char *file, unsigned int line)
sysarg_t async_answer_0 (ipc_callid_t callid, sysarg_t retval)
sysarg_t async_answer_1 (ipc_callid_t callid, sysarg_t retval, sysarg_t arg1)
sysarg_t async_answer_2 (ipc_callid_t callid, sysarg_t retval, sysarg_t arg1, sysarg_t arg2)
sysarg_t async_answer_3 (ipc_callid_t callid, sysarg_t retval, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3)
sysarg_t async_answer_4 (ipc_callid_t callid, sysarg_t retval, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4)
sysarg_t async_answer_5 (ipc_callid_t callid, sysarg_t retval, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5)
void * async_client_data_get (void)
int async_connect_kbox (task_id_t id)
 Connect to a task specified by id.
int async_connect_me_to (int phone, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3)
 Wrapper for making IPC_M_CONNECT_ME_TO calls using the async framework.
int async_connect_me_to_blocking (int phoneid, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3)
 Wrapper for making IPC_M_CONNECT_ME_TO calls using the async framework.
int async_connect_to_me (int phone, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, async_client_conn_t client_receiver)
 Wrapper for making IPC_M_CONNECT_TO_ME calls using the async framework.
void async_create_manager (void)
 Add one manager to manager list.
aid_t async_data_read (int phoneid, void *dst, size_t size, ipc_call_t *dataptr)
 Start IPC_M_DATA_READ using the async framework.
int async_data_read_finalize (ipc_callid_t callid, const void *src, size_t size)
 Wrapper for answering the IPC_M_DATA_READ calls using the async framework.
int async_data_read_forward_fast (int phoneid, sysarg_t method, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, ipc_call_t *dataptr)
 Wrapper for forwarding any read request.
bool async_data_read_receive (ipc_callid_t *callid, size_t *size)
 Wrapper for receiving the IPC_M_DATA_READ calls using the async framework.
int async_data_read_start_generic (int phoneid, void *dst, size_t size, int flags)
 Wrapper for IPC_M_DATA_READ calls using the async framework.
int async_data_write_accept (void **data, const bool nullterm, const size_t min_size, const size_t max_size, const size_t granularity, size_t *received)
 Wrapper for receiving binary data or strings.
int async_data_write_finalize (ipc_callid_t callid, void *dst, size_t size)
 Wrapper for answering the IPC_M_DATA_WRITE calls using the async framework.
int async_data_write_forward_fast (int phoneid, sysarg_t method, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, ipc_call_t *dataptr)
 Wrapper for forwarding any data that is about to be received.
bool async_data_write_receive (ipc_callid_t *callid, size_t *size)
 Wrapper for receiving the IPC_M_DATA_WRITE calls using the async framework.
int async_data_write_start_generic (int phoneid, const void *src, size_t size, int flags)
 Wrapper for IPC_M_DATA_WRITE calls using the async framework.
void async_data_write_void (sysarg_t retval)
 Wrapper for voiding any data that is about to be received.
void async_destroy_manager (void)
 Remove one manager from manager list.
int async_exchange_begin (async_sess_t *sess)
 Start new exchange in a session.
void async_exchange_end (async_sess_t *sess, int data_phone)
 Finish an exchange.
int async_forward_fast (ipc_callid_t callid, int phoneid, sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, unsigned int mode)
int async_forward_slow (ipc_callid_t callid, int phoneid, sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5, unsigned int mode)
ipc_callid_t async_get_call_timeout (ipc_call_t *call, suseconds_t usecs)
 Return new incoming message for the current (fibril-local) connection.
int async_hangup (int phone)
 Wrapper for ipc_hangup.
void async_insert_timeout (awaiter_t *wd)
 Sort in current fibril's timeout request.
static int async_manager_fibril (void *arg)
 Function to start async_manager as a standalone fibril.
static int async_manager_worker (void)
 Endless loop dispatching incoming calls and answers.
void async_msg_0 (int phone, sysarg_t imethod)
void async_msg_1 (int phone, sysarg_t imethod, sysarg_t arg1)
void async_msg_2 (int phone, sysarg_t imethod, sysarg_t arg1, sysarg_t arg2)
void async_msg_3 (int phone, sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3)
void async_msg_4 (int phone, sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4)
void async_msg_5 (int phone, sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5)
fid_t async_new_connection (sysarg_t in_task_hash, sysarg_t in_phone_hash, ipc_callid_t callid, ipc_call_t *call, void(*cfibril)(ipc_callid_t, ipc_call_t *))
 Create a new fibril for a new connection.
void async_poke (void)
 Interrupt one thread of this task from waiting for IPC.
sysarg_t async_req_fast (int phoneid, sysarg_t method, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t *r1, sysarg_t *r2, sysarg_t *r3, sysarg_t *r4, sysarg_t *r5)
 Pseudo-synchronous message sending - fast version.
sysarg_t async_req_slow (int phoneid, sysarg_t method, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5, sysarg_t *r1, sysarg_t *r2, sysarg_t *r3, sysarg_t *r4, sysarg_t *r5)
 Pseudo-synchronous message sending - slow version.
aid_t async_send_fast (int phoneid, sysarg_t method, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, ipc_call_t *dataptr)
 Send message and return id of the sent message.
aid_t async_send_slow (int phoneid, sysarg_t method, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5, ipc_call_t *dataptr)
 Send message and return id of the sent message.
static void async_serialize_end (void)
static void async_serialize_start (void)
void async_session_create (async_sess_t *sess, int phone, sysarg_t arg1)
 Create a session.
void async_session_destroy (async_sess_t *sess)
 Destroy a session.
void async_set_client_connection (async_client_conn_t conn)
 Setter for client_connection function pointer.
void async_set_client_data_constructor (async_client_data_ctor_t ctor)
void async_set_client_data_destructor (async_client_data_dtor_t dtor)
void async_set_interrupt_received (async_client_conn_t intr)
 Setter for interrupt_received function pointer.
int async_share_in_finalize (ipc_callid_t callid, void *src, unsigned int flags)
 Wrapper for answering the IPC_M_SHARE_IN calls using the async framework.
bool async_share_in_receive (ipc_callid_t *callid, size_t *size)
 Wrapper for receiving the IPC_M_SHARE_IN calls using the async framework.
int async_share_in_start (int phoneid, void *dst, size_t size, sysarg_t arg, unsigned int *flags)
 Wrapper for IPC_M_SHARE_IN calls using the async framework.
int async_share_out_finalize (ipc_callid_t callid, void *dst)
 Wrapper for answering the IPC_M_SHARE_OUT calls using the async framework.
bool async_share_out_receive (ipc_callid_t *callid, size_t *size, unsigned int *flags)
 Wrapper for receiving the IPC_M_SHARE_OUT calls using the async framework.
int async_share_out_start (int phoneid, void *src, unsigned int flags)
 Wrapper for IPC_M_SHARE_OUT calls using the async framework.
void async_usleep (suseconds_t timeout)
 Wait for specified time.
void async_wait_for (aid_t amsgid, sysarg_t *retval)
 Wait for a message sent by the async framework.
int async_wait_timeout (aid_t amsgid, sysarg_t *retval, suseconds_t timeout)
 Wait for a message sent by the async framework, timeout variant.
static atomic_count_t atomic_get (atomic_t *val)
static void atomic_set (atomic_t *val, atomic_count_t i)
int bcmp (const void *s1, const void *s2, size_t len)
 Compare two memory areas.
void bin_order_suffix (const uint64_t val, uint64_t *rv, const char **suffix, bool fixed)
int bind_service (services_t need, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, async_client_conn_t client_receiver)
 Create bidirectional connection with the needed module service and registers the message receiver.
int bind_service_timeout (services_t need, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, async_client_conn_t client_receiver, suseconds_t timeout)
 Create bidirectional connection with the needed module service and registers the message receiver.
static void block_check (void *addr)
 Check a heap block.
static void block_init (void *addr, size_t size, bool free, heap_area_t *area)
 Initialize a heap block.
void * calloc (const size_t nmemb, const size_t size)
 Allocate memory by number of elements.
char * canonify (char *path, size_t *lenp)
 Canonify a file system path.
int cap_grant (task_id_t id, unsigned int caps)
 Grant capabilities to a task.
int cap_revoke (task_id_t id, unsigned int caps)
 Revoke capabilities from a task.
static bool cas (atomic_t *val, atomic_count_t ov, atomic_count_t nv)
ssize_t char_dev_read (int dev_phone, void *buf, size_t size)
 Read from character device.
static ssize_t char_dev_rw (int dev_phone, void *buf, size_t size, bool read)
 Read to or write from device.
ssize_t char_dev_write (int dev_phone, void *buf, size_t size)
 Write to character device.
int char_map_add (char_map_t *map, const uint8_t *identifier, size_t length, const int value)
 Adds the value with the key to the map.
static int char_map_add_item (char_map_t *map, const uint8_t *identifier, size_t length, const int value)
 Adds the value with the key to the map.
void char_map_destroy (char_map_t *map)
 Clears and destroys the map.
int char_map_exclude (char_map_t *map, const uint8_t *identifier, size_t length)
 Excludes the value assigned to the key from the map.
int char_map_find (const char_map_t *map, const uint8_t *identifier, size_t length)
 Returns the value assigned to the key from the map.
static char_map_tchar_map_find_node (const char_map_t *map, const uint8_t *identifier, size_t length)
 Returns the node assigned to the key from the map.
int char_map_initialize (char_map_t *map)
 Initializes the map.
static int char_map_is_valid (const char_map_t *map)
 Checks if the map is valid.
int char_map_update (char_map_t *map, const uint8_t *identifier, const size_t length, const int value)
 Adds or updates the value with the key to the map.
int chdir (const char *path)
static void check_for_deadlock (fibril_owner_info_t *oi)
bool chr_check (wchar_t ch)
 Check whether character is valid.
int chr_encode (const wchar_t ch, char *str, size_t *offset, size_t size)
 Encode a single character to string representation.
void clearerr (FILE *stream)
static int client_compare (unsigned long key[], hash_count_t keys, link_t *item)
static hash_index_t client_hash (unsigned long key[])
static void client_remove (link_t *item)
static void clip_connect (void)
 Connect to clipboard server.
int clipboard_get_str (char **str)
 Get a copy of clipboard contents.
int clipboard_put_str (const char *str)
 Copy string to clipboard.
int close (int fildes)
int closedir (DIR *dirp)
static int conn_compare (unsigned long key[], hash_count_t keys, link_t *item)
 Compare hash table item with a key.
static hash_index_t conn_hash (unsigned long key[])
 Compute hash into the connection hash table based on the source phone hash.
static void conn_node_initialize (conn_node_t *conn)
static void conn_remove (link_t *item)
int connect_to_service (services_t need)
 Connects to the needed module.
int connect_to_service_timeout (services_t need, suseconds_t timeout)
 Connects to the needed module.
static int connection_fibril (void *arg)
 Wrapper for client connection fibril.
void console_clear (int phone)
void console_cursor_visibility (int phone, bool show)
int console_get_color_cap (int phone, sysarg_t *ccap)
bool console_get_event (int phone, console_event_t *event)
int console_get_pos (int phone, sysarg_t *col, sysarg_t *row)
int console_get_size (int phone, sysarg_t *cols, sysarg_t *rows)
void console_kcon_enable (int phone)
void console_set_color (int phone, uint8_t fg_color, uint8_t bg_color, uint8_t flags)
void console_set_pos (int phone, sysarg_t col, sysarg_t row)
void console_set_rgb_color (int phone, uint32_t fg_color, uint32_t bg_color)
void console_set_style (int phone, uint8_t style)
void context_restore (context_t *ctx)
int context_save (context_t *ctx)
int data_reply (void *data, size_t data_length)
 Replies the data to the other party.
static void default_client_connection (ipc_callid_t callid, ipc_call_t *call)
 Default fibril function that gets called to handle new connection.
static void * default_client_data_constructor (void)
static void default_client_data_destructor (void *data)
static void default_interrupt_received (ipc_callid_t callid, ipc_call_t *call)
 Default fibril function that gets called to handle interrupt notifications.
int device_assign_devno (void)
 Return unique device number.
int devman_add_device_to_class (devman_handle_t devman_handle, const char *class_name)
int devman_add_function (const char *name, fun_type_t ftype, match_id_list_t *match_ids, devman_handle_t devh, devman_handle_t *funh)
 Add function to a device.
int devman_device_connect (devman_handle_t handle, unsigned int flags)
int devman_device_get_handle (const char *pathname, devman_handle_t *handle, unsigned int flags)
int devman_device_get_handle_by_class (const char *classname, const char *devname, devman_handle_t *handle, unsigned int flags)
int devman_driver_register (const char *name, async_client_conn_t conn)
 Register running driver with device manager.
int devman_get_device_path (devman_handle_t handle, char *path, size_t path_size)
int devman_get_phone (devman_interface_t iface, unsigned int flags)
void devman_hangup_phone (devman_interface_t iface)
int devman_parent_device_connect (devman_handle_t handle, unsigned int flags)
static int devman_send_match_id (int phone, match_id_t *match_id)
static int devman_send_match_ids (int phone, match_id_list_t *match_ids)
size_t devmap_count_devices (devmap_handle_t)
size_t devmap_count_namespaces (void)
int devmap_device_connect (devmap_handle_t, unsigned int)
int devmap_device_get_handle (const char *, devmap_handle_t *, unsigned int)
int devmap_device_register (const char *, devmap_handle_t *)
 Register new device.
int devmap_device_register_with_iface (const char *, devmap_handle_t *, sysarg_t)
 Register new device.
int devmap_driver_register (const char *, async_client_conn_t)
 Register new driver with devmap.
size_t devmap_get_devices (devmap_handle_t, dev_desc_t **)
size_t devmap_get_namespaces (dev_desc_t **)
int devmap_get_phone (devmap_interface_t, unsigned int)
 Get phone to device mapper task.
devmap_handle_type_t devmap_handle_probe (devmap_handle_t)
void devmap_hangup_phone (devmap_interface_t iface)
int devmap_namespace_get_handle (const char *, devmap_handle_t *, unsigned int)
int devmap_null_create (void)
void devmap_null_destroy (int)
int dup2 (int oldfd, int newfd)
int dyn_fifo_destroy (dyn_fifo_t *fifo)
 Clears and destroys the queue.
int dyn_fifo_initialize (dyn_fifo_t *fifo, int size)
 Initializes the dynamic queue.
static int dyn_fifo_is_valid (dyn_fifo_t *fifo)
 Checks if the queue is valid.
int dyn_fifo_pop (dyn_fifo_t *fifo)
 Returns and excludes the first item in the queue.
int dyn_fifo_push (dyn_fifo_t *fifo, int value, int max_size)
 Appends a new item to the queue end.
int dyn_fifo_value (dyn_fifo_t *fifo)
 Returns and keeps the first item in the queue.
void dyn_parse_arch (elf_dyn_t *dp, size_t bias, dyn_info_t *info)
void dynamic_parse (elf_dyn_t *dyn_ptr, size_t bias, dyn_info_t *info)
void entry_point_jmp (void *, void *)
 Jump to program entry point.
int event_subscribe (event_type_t, sysarg_t)
 Subscribe event notifications.
int event_unmask (event_type_t)
 Unmask event notifications.
void exit (int status)
int fclose (FILE *stream)
int fd_node (int fildes, fdi_node_t *node)
int fd_phone (int fildes)
FILEfdopen (int fd, const char *mode)
int feof (FILE *stream)
int ferror (FILE *stream)
int fflush (FILE *stream)
int fgetc (FILE *stream)
char * fgets (char *str, int size, FILE *stream)
void fibril_add_manager (fid_t fid)
 Add a fibril to the manager list.
void fibril_add_ready (fid_t fid)
 Add a fibril to the ready list.
void fibril_condvar_broadcast (fibril_condvar_t *fcv)
void fibril_condvar_initialize (fibril_condvar_t *fcv)
static FIBRIL_CONDVAR_INITIALIZE (avail_phone_cv)
 Condition variable used to wait for a phone to become available.
void fibril_condvar_signal (fibril_condvar_t *fcv)
void fibril_condvar_wait (fibril_condvar_t *fcv, fibril_mutex_t *fm)
int fibril_condvar_wait_timeout (fibril_condvar_t *fcv, fibril_mutex_t *fm, suseconds_t timeout)
fid_t fibril_create (int(*func)(void *), void *arg)
 Create a new fibril.
void fibril_dec_sercount (void)
 Restore the preemption counter to the previous state.
fid_t fibril_get_id (void)
 Return fibril id of the currently running fibril.
int fibril_get_sercount (void)
void fibril_inc_sercount (void)
 Disable preemption.
static void fibril_main (void)
 Function that spans the whole life-cycle of a fibril.
static FIBRIL_MUTEX_INITIALIZE (log_serializer)
 Serialization mutex for logging functions.
void fibril_mutex_initialize (fibril_mutex_t *fm)
bool fibril_mutex_is_locked (fibril_mutex_t *fm)
void fibril_mutex_lock (fibril_mutex_t *fm)
bool fibril_mutex_trylock (fibril_mutex_t *fm)
void fibril_mutex_unlock (fibril_mutex_t *fm)
void fibril_remove_manager (void)
 Remove one manager from the manager list.
void fibril_rwlock_initialize (fibril_rwlock_t *frw)
bool fibril_rwlock_is_locked (fibril_rwlock_t *frw)
bool fibril_rwlock_is_read_locked (fibril_rwlock_t *frw)
bool fibril_rwlock_is_write_locked (fibril_rwlock_t *frw)
void fibril_rwlock_read_lock (fibril_rwlock_t *frw)
void fibril_rwlock_read_unlock (fibril_rwlock_t *frw)
void fibril_rwlock_write_lock (fibril_rwlock_t *frw)
void fibril_rwlock_write_unlock (fibril_rwlock_t *frw)
fibril_tfibril_setup (void)
 Setup fibril information into TCB structure.
int fibril_switch (fibril_switch_type_t stype)
 Switch from the current fibril.
void fibril_teardown (fibril_t *fibril)
static int fibril_yield (void)
int fileno (FILE *stream)
int fnode (FILE *stream, fdi_node_t *node)
FILEfopen (const char *path, const char *mode)
 Open a stream.
FILEfopen_node (fdi_node_t *node, const char *mode)
int fphone (FILE *stream)
int fprintf (FILE *stream, const char *fmt,...)
 Print formatted text.
int fputc (wchar_t c, FILE *stream)
int fputs (const char *str, FILE *stream)
size_t fread (void *dest, size_t size, size_t nmemb, FILE *stream)
 Read from a stream.
void free (const void *addr)
 Free a memory block.
int fseek (FILE *stream, off64_t offset, int whence)
int fstat (int fildes, struct stat *stat)
int fsync (int fildes)
off64_t ftell (FILE *stream)
int ftruncate (int fildes, aoff64_t length)
int futex_down (futex_t *futex)
 Down the futex.
void futex_initialize (futex_t *futex, int val)
 Initialize futex counter.
int futex_trydown (futex_t *futex)
 Try to down the futex.
int futex_up (futex_t *futex)
 Up the futex.
size_t fwrite (const void *buf, size_t size, size_t nmemb, FILE *stream)
 Write to a stream.
 GENERIC_FIELD_DECLARE (gpm, packet_map_t)
 Packet map.
int getchar (void)
char * getcwd (char *buf, size_t size)
int gettimeofday (struct timeval *tv, struct timezone *tz)
 Get time of day.
bool gsort (void *data, size_t cnt, size_t elem_size, sort_cmp_t cmp, void *arg)
 Gnome sort wrapper.
static void handle_call (ipc_callid_t callid, ipc_call_t *call)
 Handle a call that was received.
static void handle_expired_timeouts (void)
 Fire all timeouts that expired.
void hash_table_apply (hash_table_t *h, void(*f)(link_t *, void *), void *arg)
 Apply fucntion to all items in hash table.
bool hash_table_create (hash_table_t *h, hash_count_t m, hash_count_t max_keys, hash_table_operations_t *op)
 Create chained hash table.
void hash_table_destroy (hash_table_t *h)
 Destroy a hash table instance.
link_thash_table_find (hash_table_t *h, unsigned long key[])
 Search hash table for an item matching keys.
void hash_table_insert (hash_table_t *h, unsigned long key[], link_t *item)
 Insert item into a hash table.
void hash_table_remove (hash_table_t *h, unsigned long key[], hash_count_t keys)
 Remove all matching items from hash table.
static void headless_list_concat (link_t *part1, link_t *part2)
 Concatenate two headless doubly-linked circular lists.
static void headless_list_split (link_t *part1, link_t *part2)
 Split headless doubly-linked circular list.
static void headless_list_split_or_concat (link_t *part1, link_t *part2)
 Split or concatenate headless doubly-linked circular list.
void * heap_check (void)
static bool heap_grow (size_t size)
 Try to enlarge any of the heap areas.
static void heap_shrink (heap_area_t *area)
 Try to shrink heap.
static void hw_res_clean_resource_list (hw_resource_list_t *hw_res)
bool hw_res_enable_interrupt (int dev_phone)
int hw_res_get_resource_list (int dev_phone, hw_resource_list_t *hw_resources)
int icmp_connect_module (suseconds_t timeout)
 Connect to the ICMP module.
int inet_ntop (uint16_t family, const uint8_t *data, char *address, size_t length)
 Prints the address into the character buffer.
int inet_pton (uint16_t family, const char *address, uint8_t *data)
 Parses the character string into the address.
 INT_MAP_DECLARE (sockets, socket_t)
 Sockets map.
int iospace_enable (task_id_t id, void *ioaddr, unsigned long size)
 Enable I/O space range to task.
static int isalnum (int c)
static int isalpha (int c)
static int isdigit (int c)
static int islower (int c)
static int isspace (int c)
static int isupper (int c)
int klog_printf (const char *fmt,...)
 Print formatted text to klog.
void klog_update (void)
int klog_vprintf (const char *fmt, va_list ap)
 Print formatted text to klog.
static int klog_vprintf_str_write (const char *str, size_t size, void *data)
static int klog_vprintf_wstr_write (const wchar_t *str, size_t size, void *data)
size_t klog_write (const void *buf, size_t size)
static void link_initialize (link_t *link)
 Initialize doubly-linked circular list link.
static void list_append (link_t *link, link_t *list)
 Add item to the end of doubly-linked circular list.
void list_concat (link_t *head1, link_t *head2)
 Concatenate two lists.
unsigned int list_count (const link_t *link)
 Count list items.
static int list_empty (link_t *list)
 Query emptiness of doubly-linked circular list.
static link_tlist_head (link_t *list)
 Get head item of a list.
static void list_initialize (link_t *list)
 Initialize doubly-linked circular list.
static LIST_INITIALIZE (session_list_head)
 List of all open sessions.
static LIST_INITIALIZE (inactive_conn_head)
 List of all currently inactive connections.
static void list_insert_after (link_t *link, link_t *list)
 Insert item after another item in doubly-linked circular list.
static void list_insert_before (link_t *link, link_t *list)
 Insert item before another item in doubly-linked circular list.
int list_member (const link_t *link, const link_t *head)
 Check for membership.
static link_tlist_nth (link_t *list, unsigned int n)
 Get n-th item of a list.
static void list_prepend (link_t *link, link_t *list)
 Add item to the beginning of doubly-linked circular list.
static void list_remove (link_t *link)
 Remove item from doubly-linked circular list.
void loader_abort (loader_t *ldr)
 Cancel the loader session.
loader_tloader_connect (void)
int loader_get_task_id (loader_t *ldr, task_id_t *task_id)
 Get ID of the new task.
int loader_load_program (loader_t *ldr)
 Instruct loader to load the program.
int loader_run (loader_t *ldr)
 Instruct loader to execute the program.
int loader_set_args (loader_t *ldr, const char *const argv[])
 Set command-line arguments for the program.
int loader_set_cwd (loader_t *ldr)
 Set current working directory for the loaded task.
int loader_set_files (loader_t *ldr, fdi_node_t *const files[])
 Set preset files for the program.
int loader_set_pathname (loader_t *ldr, const char *path)
 Set pathname of the program to load.
int loader_spawn (const char *name)
 Connect to a new program loader.
int log_init (const char *prog_name, log_level_t level)
 Initialize the logging system.
void log_msg (log_level_t level, const char *fmt,...)
 Write an entry to the log.
void log_msgv (log_level_t level, const char *fmt, va_list args)
 Write an entry to the log (va_list variant).
off64_t lseek (int fildes, off64_t offset, int whence)
int main (int, char *[])
 Main entry point.
void * malloc (const size_t size)
 Allocate memory.
static void * malloc_area (heap_area_t *area, heap_block_head_t *first_block, heap_block_head_t *final_block, size_t real_size, size_t falign)
 Allocate memory from heap area starting from given block.
static void * malloc_internal (const size_t size, const size_t align)
 Allocate a memory block.
measured_string_tmeasured_string_copy (measured_string_t *source)
 Copies the given measured string with separated header and data parts.
measured_string_tmeasured_string_create_bulk (const uint8_t *string, size_t length)
 Creates a new measured string bundled with a copy of the given string itself as one memory block.
int measured_strings_receive (measured_string_t **strings, uint8_t **data, size_t count)
 Receives a measured strings array from a calling module.
int measured_strings_reply (const measured_string_t *strings, size_t count)
 Replies the given measured strings array to a calling module.
int measured_strings_return (int phone, measured_string_t **strings, uint8_t **data, size_t count)
 Receives a measured strings array from another module.
int measured_strings_send (int phone, const measured_string_t *strings, size_t count)
 Sends the given measured strings array to another module.
void * memalign (const size_t align, const size_t size)
 Allocate memory with specified alignment.
void * memcpy (void *dst, const void *src, size_t n)
 Copy memory block.
void * memmove (void *dst, const void *src, size_t n)
 Move memory block with possible overlapping.
void * memset (void *dest, int b, size_t n)
 Fill memory block with a constant value.
int mkdir (const char *path, mode_t mode)
void * mmap (void *start, size_t length, int prot, int flags, int fd, aoff64_t offset)
module_tmodule_find (const char *name)
 Find module structure by soname/pathname.
module_tmodule_load (const char *name)
 Load a module.
void module_load_deps (module_t *m)
 Load all modules on which m (transitively) depends.
void module_process_pre_arch (module_t *m)
void module_process_relocs (module_t *m)
 (Eagerly) process all relocation tables in a module.
void modules_process_relocs (module_t *start)
 Process relocations in modules.
void modules_untag (void)
 Clear BFS tags of all modules.
int mount (const char *fs_name, const char *mp, const char *fqdn, const char *opts, unsigned int flags)
int munmap (void *start, size_t length)
static token_t next_token (token_t *cur)
 Given a token, return the next token.
static int notification_fibril (void *arg)
 Notification fibril.
int open (const char *path, int oflag,...)
static int open_internal (const char *abs, size_t abs_size, int lflag, int oflag)
int open_node (fdi_node_t *node, int oflag)
DIRopendir (const char *dirname)
static void optimize_execution_power (void)
void order_suffix (const uint64_t val, uint64_t *rv, char *suffix)
static int packet_is_valid (const packet_t *packet)
 Returns whether the packet is valid.
static size_t PAGES2SIZE (size_t pages)
static bool parse_mode (const char *mode, int *flags)
int physmem_map (void *pf, void *vp, unsigned long pages, int flags)
 Map piece of physical memory to task.
int pio_enable (void *pio_addr, size_t size, void **use_addr)
 Enable PIO for specified I/O range.
void pq_destroy (packet_t *first, void(*packet_release)(packet_t *packet))
 Releases the whole queue.
static size_tprepare_lengths (const measured_string_t *strings, size_t count)
 Computes the lengths of the measured strings in the given array.
static void print_deadlock (fibril_owner_info_t *oi)
int printf (const char *fmt,...)
 Print formatted text to stdout.
int printf_core (const char *, printf_spec_t *, va_list)
 Print formatted string.
static bool process_notification (ipc_callid_t callid, ipc_call_t *call)
 Process interrupt notification.
link_tprodcons_consume (prodcons_t *pc)
void prodcons_initialize (prodcons_t *pc)
void prodcons_produce (prodcons_t *pc, link_t *item)
int putchar (wchar_t c)
int puts (const char *str)
bool qsort (void *data, size_t cnt, size_t elem_size, sort_cmp_t cmp, void *arg)
 Quicksort wrapper.
long int random (void)
ssize_t read (int fildes, void *buf, size_t nbyte)
direntreaddir (DIR *dirp)
void * realloc (const void *addr, const size_t size)
 Reallocate memory block.
static ssize_t recvfrom_core (sysarg_t message, int socket_id, void *data, size_t datalength, int flags, struct sockaddr *fromaddr, socklen_t *addrlen)
 Receives data via the socket.
void refresh_answer (ipc_call_t *answer, size_t *count)
 Refresh answer structure and argument count.
int register_irq (int inr, int devno, int method, irq_code_t *ucode)
 Register IRQ notification.
void rel_table_process (module_t *m, elf_rel_t *rt, size_t rt_size)
 Process (fixup) all relocations in a relocation table.
void rela_table_process (module_t *m, elf_rela_t *rt, size_t rt_size)
static void remove_trailing_slash (token_t *t, token_t *tfsl, token_t *tlcomp)
int rename (const char *old, const char *new)
static void reply_received (void *arg, int retval, ipc_call_t *data)
 Reply received callback.
void rewind (FILE *stream)
void rewinddir (DIR *dirp)
int rmdir (const char *path)
static bool route_call (ipc_callid_t callid, ipc_call_t *call)
 Try to route a call to an appropriate connection fibril.
void rtld_init_static (void)
 Initialize the loder for use in a statically-linked binary.
static void save_component (token_t *t, token_t *tfsl, token_t *tlcomp)
static int sendto_core (sysarg_t message, int socket_id, const void *data, size_t datalength, int flags, const struct sockaddr *toaddr, socklen_t addrlen)
 Sends data via the socket to the remote address.
int service_connect (sysarg_t service, sysarg_t arg2, sysarg_t arg3)
int service_connect_blocking (sysarg_t service, sysarg_t arg2, sysarg_t arg3)
int service_register (sysarg_t service)
static void set_first_slash (token_t *t, token_t *tfsl, token_t *tlcomp)
void setvbuf (FILE *stream, void *buf, int mode, size_t size)
 Set stream buffer.
static void shift_dot (token_t *t, token_t *tfsl, token_t *tlcomp)
 Eat the extra '.
static void shift_dotdot (token_t *t, token_t *tfsl, token_t *tlcomp)
 Collapse the TK_COMP TK_SLASH TK_DOTDOT pattern.
static void shift_slash (token_t *t, token_t *tfsl, token_t *tlcomp)
 Eat the extra '/'.
static size_t SIZE2PAGES (size_t size)
static token_t slash_token (char *start)
 Fake up the TK_SLASH token.
unsigned int sleep (unsigned int sec)
 Wait unconditionally for specified number of seconds.
int smc_coherence (void *address, size_t size)
int snprintf (char *str, size_t size, const char *fmt,...)
 Print formatted to the given buffer with limited size.
static void socket_connection (ipc_callid_t iid, ipc_call_t *icall)
 Default thread for new connections.
static void socket_destroy (socket_t *socket)
 Clears and destroys the socket.
static int socket_generate_new_id (void)
 Tries to find a new free socket identifier.
static sockets_t * socket_get_sockets (void)
 Returns the active sockets.
static int socket_get_tcp_phone (void)
 Returns the TCP module phone.
static int socket_get_udp_phone (void)
 Returns the UDP module phone.
static void socket_initialize (socket_t *socket, int socket_id, int phone, services_t service)
 Initializes a new socket specific data.
static int socket_send_data (int socket_id, sysarg_t message, sysarg_t arg2, const void *data, size_t datalength)
 Sends message to the socket parent module with specified data.
static void split_mark (heap_block_head_t *cur, const size_t size)
 Split heap block and mark it as used.
void srandom (unsigned int seed)
uintptr_t stacktrace_fp_get (void)
int stacktrace_fp_prev (stacktrace_t *, uintptr_t, uintptr_t *)
bool stacktrace_fp_valid (stacktrace_t *, uintptr_t)
uintptr_t stacktrace_pc_get (void)
void stacktrace_prepare (void)
void stacktrace_print (void)
void stacktrace_print_fp_pc (uintptr_t fp, uintptr_t pc)
int stacktrace_ra_get (stacktrace_t *, uintptr_t, uintptr_t *)
static int stacktrace_read_uintptr (void *arg, uintptr_t addr, uintptr_t *data)
int stat (const char *path, struct stat *stat)
stats_cpu_t * stats_get_cpus (size_t *count)
 Get CPUs statistics.
stats_exc_t * stats_get_exception (unsigned int excn)
 Get single exception statistics.
stats_exc_t * stats_get_exceptions (size_t *count)
 Get exception statistics.
load_t * stats_get_load (size_t *count)
 Get system load.
stats_physmem_t * stats_get_physmem (void)
 Get physical memory statistics.
stats_task_t * stats_get_task (task_id_t task_id)
 Get single task statistics.
stats_task_t * stats_get_tasks (size_t *count)
 Get task statistics.
stats_thread_t * stats_get_thread (thread_id_t thread_id)
 Get single thread statistics.
stats_thread_t * stats_get_threads (size_t *count)
 Get thread statistics.
sysarg_t stats_get_uptime (void)
 Get system uptime.
void stats_print_load_fragment (load_t upper, unsigned int dec_length)
 Print load fixed-point value.
void str_append (char *dest, size_t size, const char *src)
 Append one string to another.
char * str_chr (const char *str, wchar_t ch)
 Find first occurence of character in string.
int str_cmp (const char *s1, const char *s2)
 Compare two NULL terminated strings.
void str_cpy (char *dest, size_t size, const char *src)
 Copy string.
wchar_t str_decode (const char *str, size_t *offset, size_t size)
 Decode a single character from a string.
char * str_dup (const char *src)
 Duplicate string.
const char * str_error (const int e)
const char * str_l18_win_locale (l18_win_locales_t locale)
 Get string representation of a given locale.
int str_lcmp (const char *s1, const char *s2, size_t max_len)
 Compare two NULL terminated strings with length limit.
size_t str_length (const char *str)
 Get number of characters in a string.
size_t str_lsize (const char *str, size_t max_len)
 Get size of string with length limit.
void str_ncpy (char *dest, size_t size, const char *src, size_t n)
 Copy size-limited substring.
char * str_ndup (const char *src, size_t n)
 Duplicate string with size limit.
size_t str_nlength (const char *str, size_t size)
 Get number of characters in a string with size limit.
char * str_rchr (const char *str, wchar_t ch)
 Find last occurence of character in string.
size_t str_size (const char *str)
 Get size of string.
int str_size_t (const char *nptr, char **endptr, unsigned int base, bool strict, size_t *result)
 Convert string to size_t.
void str_to_wstr (wchar_t *dest, size_t dlen, const char *src)
 Convert string to wide string.
static int str_uint (const char *nptr, char **endptr, unsigned int base, bool *neg, uint64_t *result)
 Convert string to uint64_t (internal variant).
int str_uint64 (const char *nptr, char **endptr, unsigned int base, bool strict, uint64_t *result)
 Convert string to uint64_t.
int stricmp (const char *a, const char *b)
char * strtok (char *s, const char *delim)
char * strtok_r (char *s, const char *delim, char **next)
long int strtol (const char *nptr, char **endptr, int base)
 Convert initial part of string to long int according to given base.
unsigned long strtoul (const char *nptr, char **endptr, int base)
 Convert initial part of string to unsigned long according to given base.
elf_symbol_t * symbol_bfs_find (const char *name, module_t *start, module_t **mod)
 Find the definition of a symbol in a module and its deps.
elf_symbol_t * symbol_def_find (const char *name, module_t *origin, module_t **mod)
 Find the definition of a symbol.
void * symbol_get_addr (elf_symbol_t *sym, module_t *m)
void * sysinfo_get_data (const char *path, size_t *size)
 Get sysinfo binary data.
static int sysinfo_get_data_size (const char *path, size_t *size)
 Get sysinfo binary data size.
sysinfo_item_tag_t sysinfo_get_tag (const char *path)
 Get sysinfo item type.
int sysinfo_get_value (const char *path, sysarg_t *value)
 Get sysinfo numerical value.
task_id_t task_get_id (void)
int task_kill (task_id_t task_id)
 Kill a task.
int task_retval (int val)
int task_set_name (const char *name)
 Set the task name.
int task_spawnl (task_id_t *task_id, const char *path,...)
 Create a new task by running an executable from the filesystem.
int task_spawnv (task_id_t *id, const char *path, const char *const args[])
 Create a new task by running an executable from the filesystem.
int task_wait (task_id_t id, task_exit_t *texit, int *retval)
static void terminate_slash (token_t *t, token_t *tfsl, token_t *tlcomp)
int thread_create (void(*function)(void *), void *arg, const char *name, thread_id_t *tid)
 Create userspace thread.
void thread_detach (thread_id_t thread)
 Detach thread.
void thread_exit (int status)
 Terminate current thread.
thread_id_t thread_get_id (void)
 Get current thread ID.
const char * thread_get_state (state_t state)
int thread_join (thread_id_t thread)
 Join thread.
time_t time (time_t *tloc)
static int tolower (int c)
static int toupper (int c)
void tv_add (struct timeval *tv, suseconds_t usecs)
 Add microseconds to given timeval.
int tv_gt (struct timeval *tv1, struct timeval *tv2)
 Decide if one timeval is greater than the other.
int tv_gteq (struct timeval *tv1, struct timeval *tv2)
 Decide if one timeval is greater than or equal to the other.
suseconds_t tv_sub (struct timeval *tv1, struct timeval *tv2)
 Subtract two timevals.
int udebug_areas_read (int phoneid, void *buffer, size_t n, size_t *copied, size_t *needed)
int udebug_args_read (int phoneid, thash_t tid, sysarg_t *buffer)
int udebug_begin (int phoneid)
int udebug_end (int phoneid)
int udebug_go (int phoneid, thash_t tid, udebug_event_t *ev_type, sysarg_t *val0, sysarg_t *val1)
int udebug_mem_read (int phoneid, void *buffer, uintptr_t addr, size_t n)
int udebug_name_read (int phoneid, void *buffer, size_t n, size_t *copied, size_t *needed)
int udebug_regs_read (int phoneid, thash_t tid, void *buffer)
int udebug_set_evmask (int phoneid, udebug_evmask_t mask)
int udebug_stop (int phoneid, thash_t tid)
int udebug_thread_read (int phoneid, void *buffer, size_t n, size_t *copied, size_t *needed)
void udelay (useconds_t time)
static uint16_t uint16_t_byteorder_swap (uint16_t n)
static uint32_t uint32_t_byteorder_swap (uint32_t n)
static uint64_t uint64_t_byteorder_swap (uint64_t n)
static void * unaligned_memcpy (void *dst, const void *src, size_t n)
int unlink (const char *path)
int unmount (const char *mp)
int unregister_irq (int inr, int devno)
 Unregister IRQ notification.
int usleep (useconds_t usec)
 Wait unconditionally for specified number of microseconds.
int vfprintf (FILE *stream, const char *fmt, va_list ap)
 Print formatted text.
static void vfs_connect (void)
 Connect to VFS service and create session.
static int vfs_exchange_begin (void)
 Start an async exchange on the VFS session.
static void vfs_exchange_end (int phone)
 End an async exchange on the VFS session.
int vprintf (const char *fmt, va_list ap)
 Print formatted text to stdout.
static int vprintf_str_write (const char *str, size_t size, void *stream)
static int vprintf_wstr_write (const wchar_t *str, size_t size, void *stream)
int vsnprintf (char *str, size_t size, const char *fmt, va_list ap)
static int vsnprintf_str_write (const char *str, size_t size, vsnprintf_data_t *data)
 Write string to given buffer.
static int vsnprintf_wstr_write (const wchar_t *str, size_t size, vsnprintf_data_t *data)
 Write wide string to given buffer.
ssize_t write (int fildes, const void *buf, size_t nbyte)
size_t wstr_length (const wchar_t *wstr)
 Get number of characters in a wide string.
bool wstr_linsert (wchar_t *str, wchar_t ch, size_t pos, size_t max_pos)
 Insert a wide character into a wide string.
size_t wstr_lsize (const wchar_t *str, size_t max_len)
 Get size of wide string with length limit.
size_t wstr_nlength (const wchar_t *str, size_t size)
 Get number of characters in a string with size limit.
bool wstr_remove (wchar_t *str, size_t pos)
 Remove a wide character from a wide string.
size_t wstr_size (const wchar_t *str)
 Get size of wide string.
char * wstr_to_astr (const wchar_t *src)
 Convert wide string to new string.
void wstr_to_str (char *dest, size_t size, const wchar_t *src)
 Convert wide string to string.

Variables

pcb_t__pcb
 A pointer to the program control block.
static async_client_data_ctor_t async_client_data_create
static async_client_data_dtor_t async_client_data_destroy
atomic_t async_futex = FUTEX_INITIALIZER
static fibril_mutex_t async_sess_mutex
 Mutex protecting the inactive_conn_head list, the session list and the avail_phone condition variable.
static async_client_conn_t client_connection = default_client_connection
 Pointer to a fibril function that will be used to handle connections.
static hash_table_t client_hash_table
static hash_table_operations_t client_hash_table_ops
 Operations for the client hash table.
static int clip_phone = -1
static hash_table_t conn_hash_table
static hash_table_operations_t conn_hash_table_ops
 Operations for the connection hash table.
static int cwd_fd = -1
static char * cwd_path = NULL
static size_t cwd_size = 0
static int devman_phone_client = -1
static int devman_phone_driver = -1
static bool env_setup = false
static const char * err_desc []
static atomic_t failed_asserts = {0}
static fibril_local connection_tFIBRIL_connection
 Identifier of the incoming connection handled by the current fibril.
static fibril_local int fibril_errno
static atomic_t fibril_futex = FUTEX_INITIALIZER
 This futex serializes access to ready_list, serialized_list and manager_list.
static heap_area_tfirst_heap_area = NULL
 First heap area.
static long glbl_seed = 1
static async_client_conn_t interrupt_received = default_interrupt_received
 Pointer to a fibril function that will be used to handle interrupt notifications.
struct {
   volatile sysarg_t   seconds1
   volatile sysarg_t   seconds2
   volatile sysarg_t   useconds
ktime
 Pointer to kernel shared variables with time.
static heap_area_tlast_heap_area = NULL
 Last heap area.
static log_level_t log_level
 Current log level.
static const char * log_level_names []
 Prefixes for individual logging levels.
static const char * log_prog_name
static FILElog_stream
static futex_t malloc_futex = FUTEX_INITIALIZER
 Futex for thread-safe heap manipulation.
static heap_block_head_tnext_fit = NULL
 Next heap block to examine (next fit algorithm).
static fibril_local char noerr [NOERR_LEN]
struct {
   fibril_rwlock_t   lock
 Safety lock.
   gpm_t   packet_map
 Packet map.
pm_globals
 Packet map global data.
runtime_env_truntime_env
static fibril_local int serialization_count
 Fibril-local count of serialization.
static int serialized_threads
 Number of threads that are executing a manager fibril and are serialized.
static struct socket_client_globals socket_globals
 Socket client library global data.
FILEstderr
FILEstderr = NULL
static FILE stderr_klog
FILEstdin
FILEstdin = NULL
static FILE stdin_null
FILEstdout
FILEstdout = NULL
static FILE stdout_klog
static const char * thread_states []
 Thread states.
atomic_t threads_in_ipc_wait
 Number of threads waiting for IPC in the kernel.
atomic_t threads_in_ipc_wait = { 0 }
 Number of threads waiting for IPC in the kernel.
static int threads_in_manager
 Number of threads that are executing a manager fibril.
static change_state_t trans [4][6]
 Transition function for canonify().
static fibril_local char unknown_locale [UNKNOWN_LOCALE_LEN]
static int vfs_phone = -1
static async_sess_t vfs_session

Define Documentation

#define ALIGN_DOWN ( s,
 )     ((s) & ~((a) - 1))

Align to the nearest lower address which is a power of two.

Parameters:
s Address or size to be aligned.
a Size of alignment, must be power of 2.

Definition at line 43 of file align.h.

#define ALIGN_UP ( s,
 )     ((long)((s) + ((a) - 1)) & ~((long) (a) - 1))

Align to the nearest higher address which is a power of two.

Parameters:
s Address or size to be aligned.
a Size of alignment, must be power of 2.

Definition at line 51 of file align.h.

#define ARP_GET_NETIF ( call   )     ((services_t) IPC_GET_ARG2(call))

Return the protocol service message parameter.

Parameters:
[in] call Message call structure.

Definition at line 75 of file arp.h.

#define assert ( expr   ) 

Value:

do { \
                if (!(expr)) \
                        assert_abort(#expr, __FILE__, __LINE__); \
        } while (0)
Debugging assert macro.

If NDEBUG is not set, the assert() macro evaluates expr and if it is false prints error message and terminate program.

Parameters:
expr Expression which is expected to be true.

Definition at line 51 of file assert.h.

#define BASE_ALIGN   16

Allocation alignment.

This also covers the alignment of fields in the heap header and footer.

Definition at line 65 of file malloc.c.

#define EAGAIN   (-11002)

The requested operation was not performed.

Try again later.

Definition at line 98 of file errno.h.

#define fifo_create ( name   )     name.fifo = malloc(sizeof(*name.fifo) * name.items)

Allocate memory for dynamic FIFO.

Parameters:
name FIFO name.

Definition at line 121 of file fifo.h.

#define FIFO_INITIALIZE_DYNAMIC ( name,
t,
itms   ) 

Value:

struct {                                        \
                t *fifo;                                \
                fifo_count_t items;                     \
                fifo_index_t head;                      \
                fifo_index_t tail;                      \
        } name = {                                      \
                .fifo = NULL,                           \
                .items = (itms),                        \
                .head = 0,                              \
                .tail = 0                               \
        }
Create and prepare dynamic FIFO.

FIFO is allocated dynamically. This macro is suitable for creating larger FIFOs.

Parameters:
name Name of FIFO.
t Type of values stored in FIFO.
itms Number of items that can be stored in FIFO.

Definition at line 86 of file fifo.h.

#define FIFO_INITIALIZE_STATIC ( name,
t,
itms   ) 

Value:

FIFO_CREATE_STATIC(name, t, itms) = {           \
                .items = (itms),                        \
                .head = 0,                              \
                .tail = 0                               \
        }
Create and initialize static FIFO.

FIFO is allocated statically. This macro is suitable for creating smaller FIFOs.

Parameters:
name Name of FIFO.
t Type of values stored in FIFO.
itms Number of items that can be stored in FIFO.

Definition at line 70 of file fifo.h.

#define fifo_pop ( name   )     name.fifo[name.head = (name.head + 1) < name.items ? (name.head + 1) : 0]

Pop value from head of FIFO.

Parameters:
name FIFO name.
Returns:
Leading value in FIFO.

Definition at line 105 of file fifo.h.

#define fifo_push ( name,
value   )     name.fifo[name.tail = (name.tail + 1) < name.items ? (name.tail + 1) : 0] = (value)

Push value to tail of FIFO.

Parameters:
name FIFO name.
value Value to be appended to FIFO.

Definition at line 114 of file fifo.h.

#define GENERIC_CHAR_MAP_DECLARE ( name,
type   ) 

Value:

GENERIC_FIELD_DECLARE(name##_items, type) \
        \
        typedef struct name name##_t; \
        \
        struct  name { \
                char_map_t names; \
                name##_items_t values; \
                int magic; \
        }; \
        \
        int name##_add(name##_t *, const uint8_t *, const size_t, type *); \
        int name##_count(name##_t *); \
        void name##_destroy(name##_t *, DTOR_T()); \
        void name##_exclude(name##_t *, const uint8_t *, const size_t, DTOR_T()); \
        type *name##_find(name##_t *, const uint8_t *, const size_t); \
        int name##_initialize(name##_t *); \
        int name##_is_valid(name##_t *);
Character string to generic type map declaration.

Parameters:
[in] name Name of the map.
[in] type Inner object type.

Definition at line 57 of file generic_char_map.h.

#define GENERIC_CHAR_MAP_IMPLEMENT ( name,
type   ) 

Character string to generic type map implementation.

Should follow declaration with the same parameters.

Parameters:
[in] name Name of the map.
[in] type Inner object type.

Definition at line 84 of file generic_char_map.h.

#define GENERIC_FIELD_DECLARE ( name,
type   ) 

Value:

typedef struct name name##_t; \
        \
        struct  name { \
                int size; \
                int next; \
                type **items; \
                int magic; \
        }; \
        \
        int name##_add(name##_t *, type *); \
        int name##_count(name##_t *); \
        void name##_destroy(name##_t *, DTOR_T()); \
        void name##_exclude_index(name##_t *, int, DTOR_T()); \
        type **name##_get_field(name##_t *); \
        type *name##_get_index(name##_t *, int); \
        int name##_initialize(name##_t *); \
        int name##_is_valid(name##_t *);
Generic type field declaration.

Parameters:
[in] name Name of the field.
[in] type Inner object type.

Definition at line 57 of file generic_field.h.

#define GENERIC_FIELD_IMPLEMENT ( name,
type   ) 

Generic type field implementation.

Should follow declaration with the same parameters.

Parameters:
[in] name Name of the field.
[in] type Inner object type.

Definition at line 83 of file generic_field.h.

#define GROSS_SIZE ( size   )     ((size) + STRUCT_OVERHEAD)

Calculate real size of a heap block.

Add header and footer size.

Definition at line 90 of file malloc.c.

#define IBUF_SIZE   32

Immediate buffer size.

For small buffer sizes avoid doing malloc() and use the stack.

Definition at line 52 of file sort.c.

#define ICMP_GET_CODE ( call   )     ((icmp_code_t) IPC_GET_ARG1(call))

Return the ICMP code message parameter.

Parameters:
[in] call Message call structure.

Definition at line 84 of file icmp.h.

#define ICMP_GET_DONT_FRAGMENT ( call   )     ((int) IPC_GET_ARG5(call))

Return the dont fragment message parameter.

Parameters:
[in] call Message call structure.

Definition at line 132 of file icmp.h.

#define ICMP_GET_MTU ( call   )     ((icmp_param_t) IPC_GET_ARG3(call))

Return the ICMP link MTU message parameter.

Parameters:
[in] call Message call structure.

Definition at line 91 of file icmp.h.

#define ICMP_GET_POINTER ( call   )     ((icmp_param_t) IPC_GET_ARG3(call))

Return the pointer message parameter.

Parameters:
[in] call Message call structure.

Definition at line 98 of file icmp.h.

#define ICMP_GET_SIZE ( call   )     ((size_t) IPC_GET_ARG1(call))

Return the size message parameter.

Parameters:
[in] call Message call structure.

Definition at line 105 of file icmp.h.

#define ICMP_GET_TIMEOUT ( call   )     ((suseconds_t) IPC_GET_ARG2(call))

Return the timeout message parameter.

Parameters:
[in] call Message call structure.

Definition at line 112 of file icmp.h.

#define ICMP_GET_TOS ( call   )     ((ip_tos_t) IPC_GET_ARG4(call))

Return the type of service message parameter.

Parameters:
[in] call Message call structure.

Definition at line 126 of file icmp.h.

#define ICMP_GET_TTL ( call   )     ((ip_ttl_t) IPC_GET_ARG3(call))

Return the time to live message parameter.

Parameters:
[in] call Message call structure.

Definition at line 119 of file icmp.h.

#define IL_GET_PROTO ( call   )     ((int) IPC_GET_ARG1(call))

Return the protocol number message parameter.

Parameters:
[in] call Message call structure.

Definition at line 70 of file il.h.

#define IL_GET_SERVICE ( call   )     ((services_t) IPC_GET_ARG2(call))

Return the registering service message parameter.

Parameters:
[in] call Message call structure.

Definition at line 77 of file il.h.

#define INT_MAP_DECLARE ( name,
type   ) 

Value:

typedef struct name name##_t; \
        typedef struct name##_item name##_item_t; \
        \
        struct  name##_item { \
                int key; \
                type *value; \
                int magic; \
        }; \
        \
        struct  name { \
                int size; \
                int next; \
                name##_item_t *items; \
                int magic; \
        }; \
        \
        int name##_add(name##_t *, int, type *); \
        void name##_clear(name##_t *, DTOR_T()); \
        int name##_count(name##_t *); \
        void name##_destroy(name##_t *, DTOR_T()); \
        void name##_exclude(name##_t *, int, DTOR_T()); \
        void name##_exclude_index(name##_t *, int, DTOR_T()); \
        type *name##_find(name##_t *, int); \
        int name##_update(name##_t *, int, int); \
        type *name##_get_index(name##_t *, int); \
        int name##_initialize(name##_t *); \
        int name##_is_valid(name##_t *); \
        void name##_item_destroy(name##_item_t *, DTOR_T()); \
        int name##_item_is_valid(name##_item_t *);
Integer to generic type map declaration.

Parameters:
[in] name Name of the map.
[in] type Inner object type.

Definition at line 60 of file int_map.h.

#define INT_MAP_IMPLEMENT ( name,
type   ) 

Integer to generic type map implementation.

Should follow declaration with the same parameters.

Parameters:
[in] name Name of the map.
[in] type Inner object type.

Definition at line 98 of file int_map.h.

#define IP_GET_ADDRESS ( call   ) 

Value:

({ \
                in_addr_t addr; \
                addr.s_addr = IPC_GET_ARG3(call); \
                addr; \
        })
Return the address message parameter.

Parameters:
[in] call Message call structure.

Definition at line 91 of file ip.h.

#define IP_GET_GATEWAY ( call   ) 

Value:

({ \
                in_addr_t addr; \
                addr.s_addr = IPC_GET_ARG2(call); \
                addr; \
        })
Return the gateway message parameter.

Parameters:
[in] call Message call structure.

Definition at line 103 of file ip.h.

#define IP_GET_NETMASK ( call   ) 

Value:

({ \
                in_addr_t addr; \
                addr.s_addr = IPC_GET_ARG4(call); \
                addr; \
        })
Return the network mask message parameter.

Parameters:
[in] call Message call structure.

Definition at line 122 of file ip.h.

#define IP_GET_PROTOCOL ( call   )     ((ip_protocol_t) IPC_GET_ARG1(call))

Return the protocol message parameter.

Parameters:
[in] call Message call structure.

Definition at line 134 of file ip.h.

#define IP_SET_HEADERLEN ( answer,
value   )     IPC_SET_ARG2(answer, (sysarg_t) (value))

Set the header length in the message answer.

Parameters:
[out] answer Message answer structure.

Definition at line 115 of file ip.h.

#define IPOPT_COPIED (  )     ((o) & IPOPT_COPY)

Returns a value indicating whether the IP option should be copied.

Parameters:
[in] o The IP option.

Definition at line 92 of file ip_codes.h.

#define IPOPT_TYPE ( copy,
class,
number   ) 

Value:

(((copy) & IPOPT_COPY) | ((class) & IPOPT_CLASS_MASK) | \
        (((number) << IPOPT_NUMBER_SHIFT) & IPOPT_NUMBER_MASK))
Returns IP option type.

Parameters:
[in] copy The value indication whether the IP option should be copied.
[in] class The IP option class.
[in] number The IP option number.

Definition at line 85 of file ip_codes.h.

#define LIBC_ASYNC_C_

Asynchronous library.

The aim of this library is to provide a facility for writing programs which utilize the asynchronous nature of HelenOS IPC, yet using a normal way of programming.

You should be able to write very simple multithreaded programs, the async framework will automatically take care of most synchronization problems.

Example of use (pseudo C):

1) Multithreaded client application

fibril_create(fibril1, ...); fibril_create(fibril2, ...); ...

int fibril1(void *arg) { conn = async_connect_me_to(); c1 = async_send(conn); c2 = async_send(conn); async_wait_for(c1); async_wait_for(c2); ... }

2) Multithreaded server application

main() { async_manager(); }

my_client_connection(icallid, *icall) { if (want_refuse) { async_answer_0(icallid, ELIMIT); return; } async_answer_0(icallid, EOK);

callid = async_get_call(&call); somehow_handle_the_call(callid, call); async_answer_2(callid, 1, 2, 3);

callid = async_get_call(&call); ... }

Definition at line 89 of file async.c.

#define LIST_INITIALIZE ( name   ) 

Value:

link_t name = { \
                .prev = &name, \
                .next = &name \
        }
Declare and initialize statically allocated list.

Parameters:
name Name of the new statically allocated list.

Definition at line 51 of file list.h.

#define NET_SIZE ( size   )     ((size) - STRUCT_OVERHEAD)

Calculate net size of a heap block.

Subtract header and footer size.

Definition at line 97 of file malloc.c.

#define NETIF_GET_IO ( call   )     ((void *) IPC_GET_ARG3(call))

Return the input/output address message parameter.

Parameters:
[in] call Message call structure.

Definition at line 90 of file netif.h.

#define NETIF_GET_IRQ ( call   )     ((int) IPC_GET_ARG2(call))

Return the interrupt number message parameter.

Parameters:
[in] call Mmessage call structure.

Definition at line 83 of file netif.h.

#define NEXT_INDEX ( fifo,
index   )     (((index) + 1) % ((fifo)->size + 1))

Returns the next queue index.

The queue field is circular.

Parameters:
[in] fifo The dynamic queue.
[in] index The actual index to be shifted.

Definition at line 53 of file dynamic_fifo.c.

#define PACKET_DATA_LENGTH ( header   )     ((header)->data_end - (header)->data_start)

Returns the actual packet data length.

Parameters:
[in] header The packet header.

Definition at line 45 of file packet_header.h.

#define PACKET_MAP_INDEX ( packet_id   )     (((packet_id) - 1) % PACKET_MAP_SIZE)

Returns the packet index in the corresponding packet map page.

Parameters:
[in] packet_id The packet identifier.

Definition at line 61 of file packet.c.

#define PACKET_MAP_PAGE ( packet_id   )     (((packet_id) - 1) / PACKET_MAP_SIZE)

Returns the packet map page index.

Parameters:
[in] packet_id The packet identifier.

Definition at line 56 of file packet.c.

#define PACKET_MAX_ADDRESS_LENGTH ( header   )     ((header)->dest_addr - (header)->src_addr)

Returns the maximum packet address length.

Parameters:
[in] header The packet header.

Definition at line 51 of file packet_header.h.

#define PACKET_MIN_SUFFIX ( header   )     ((header)->length - (header)->data_start - (header)->max_content)

Returns the minimum packet suffix.

Parameters:
[in] header The packet header.

Definition at line 57 of file packet_header.h.

#define ROUND_UP ( n,
b   )     (((n) / (b) + ((n) % (b) != 0)) * (b))

Round up to the nearest higher boundary.

Parameters:
n Number to be aligned.
b Boundary, arbitrary unsigned number.

Definition at line 58 of file align.h.

#define SHRINK_GRANULARITY   (64 * PAGE_SIZE)

Heap shrink granularity.

Try not to pump and stress the heap to much by shrinking and enlarging it too often. A heap area won't shrunk if it the released free block is smaller than this constant.

Definition at line 75 of file malloc.c.

#define SOCKET_GET_ADDRESS_LENGTH ( call   ) 

Value:

({ \
                socklen_t address_length = (socklen_t) IPC_GET_ARG3(call); \
                address_length; \
        })
Returns the address length message parameter.

Parameters:
[in] call The message call structure.

Definition at line 164 of file socket.h.

#define SOCKET_GET_BACKLOG ( call   ) 

Value:

({ \
                int backlog = (int) IPC_GET_ARG2(call); \
                backlog; \
        })
Returns the backlog message parameter.

Parameters:
[in] call The message call structure.

Definition at line 119 of file socket.h.

#define SOCKET_GET_DATA_FRAGMENT_SIZE ( call   ) 

Value:

({ \
                size_t size = (size_t) IPC_GET_ARG2(call); \
                size; \
        })
Returns the data fragment size message parameter.

Parameters:
[in] call The message call structure.

Definition at line 137 of file socket.h.

#define SOCKET_GET_DATA_FRAGMENTS ( call   ) 

Value:

({ \
                int fragments = (int) IPC_GET_ARG5(call); \
                fragments; \
        })
Returns the data fragments message parameter.

Parameters:
[in] call The message call structure.

Definition at line 209 of file socket.h.

#define SOCKET_GET_FLAGS ( call   ) 

Value:

({ \
                int flags = (int) IPC_GET_ARG4(call); \
                flags; \
        })
Returns the flags message parameter.

Parameters:
[in] call The message call structure.

Definition at line 191 of file socket.h.

#define SOCKET_GET_HEADER_SIZE ( call   ) 

Value:

({ \
                size_t size = (size_t) IPC_GET_ARG3(call); \
                size; \
        })
Returns the header size message parameter.

Parameters:
[in] call The message call structure.

Definition at line 182 of file socket.h.

#define SOCKET_GET_NEW_SOCKET_ID ( call   ) 

Value:

({ \
                int socket_id = (int) IPC_GET_ARG5(call); \
                socket_id; \
        })
Returns the new socket identifier message parameter.

Parameters:
[in] call The message call structure.

Definition at line 218 of file socket.h.

#define SOCKET_GET_OPT_LEVEL ( call   ) 

Value:

({ \
                int opt_level = (int) IPC_GET_ARG2(call); \
                opt_level; \
        })
Returns the option level message parameter.

Parameters:
[in] call The message call structure.

Definition at line 128 of file socket.h.

#define SOCKET_GET_OPT_NAME ( call   ) 

Value:

({ \
                int opt_name = (int) IPC_GET_ARG4(call); \
                opt_name; \
        })
Returns the option name message parameter.

Parameters:
[in] call The message call structure.

Definition at line 200 of file socket.h.

#define SOCKET_GET_READ_DATA_LENGTH ( call   ) 

Value:

({ \
                int data_length = (int) IPC_GET_ARG1(call); \
                data_length; \
        })
Returns the read data length message parameter.

Parameters:
[in] call The message call structure.

Definition at line 110 of file socket.h.

#define SOCKET_GET_SOCKET_ID ( call   ) 

Value:

({ \
                int socket_id = (int) IPC_GET_ARG1(call); \
                socket_id; \
        })
Returns the socket identifier message parameter.

Parameters:
[in] call The message call structure.

Definition at line 92 of file socket.h.

#define SOCKET_SET_ADDRESS_LENGTH ( answer,
value   ) 

Value:

do { \
                sysarg_t argument = (sysarg_t) (value); \
                IPC_SET_ARG3(answer, argument);\
        } while (0)
Sets the address length in the message answer.

Parameters:
[out] answer The message answer structure.

Definition at line 155 of file socket.h.

#define SOCKET_SET_DATA_FRAGMENT_SIZE ( answer,
value   ) 

Value:

do { \
                sysarg_t argument = (sysarg_t) (value); \
                IPC_SET_ARG2(answer, argument); \
        } while (0)
Sets the data fragment size in the message answer.

Parameters:
[out] answer The message answer structure.

Definition at line 146 of file socket.h.

#define SOCKET_SET_HEADER_SIZE ( answer,
value   ) 

Value:

do { \
                sysarg_t argument = (sysarg_t) (value); \
                IPC_SET_ARG3(answer, argument); \
        } while (0)
Sets the header size in the message answer.

Parameters:
[out] answer The message answer structure.

Definition at line 173 of file socket.h.

#define SOCKET_SET_READ_DATA_LENGTH ( answer,
value   ) 

Value:

do { \
                sysarg_t argument = (sysarg_t) (value); \
                IPC_SET_ARG1(answer, argument); \
        } while (0)
Sets the read data length in the message answer.

Parameters:
[out] answer The message answer structure.

Definition at line 101 of file socket.h.

#define SOCKET_SET_SOCKET_ID ( answer,
value   ) 

Value:

do { \
                sysarg_t argument = (sysarg_t) (value); \
                IPC_SET_ARG1(answer, argument); \
        } while (0)
Sets the socket identifier in the message answer.

Parameters:
[out] answer The message answer structure.

Definition at line 83 of file socket.h.


Typedef Documentation

typedef struct addrinfo addrinfo_t

Type definition of the address information.

See also:
addrinfo

Definition at line 51 of file inet.h.

typedef struct char_map char_map_t

Type definition of the character string to integer map.

See also:
char_map

Definition at line 48 of file char_map.h.

typedef int connect_module_t(services_t need)

Connect to the needed module function type definition.

Parameters:
[in] need The needed module service.
Returns:
The phone of the needed service.

Definition at line 55 of file modules.h.

typedef struct device_stats device_stats_t

Type definition of the device usage statistics.

See also:
device_stats

Definition at line 60 of file device.h.

typedef struct dyn_fifo dyn_fifo_t

Type definition of the dynamic fifo queue.

See also:
dyn_fifo

Definition at line 44 of file dynamic_fifo.h.

typedef struct dyn_info dyn_info_t

Holds the data extracted from an ELF Dynamic section.

The data is already pre-processed: Pointers are adjusted to their final run-time values by adding the load bias and indices into the symbol table are converted to pointers.

typedef struct heap_area heap_area_t

Heap area.

The memory managed by the heap allocator is divided into multiple discontinuous heaps. Each heap is represented by a separate address space area which has this structure at its very beginning.

typedef struct in6_addr in6_addr_t

Type definition of the INET6 address.

See also:
in6_addr

Definition at line 50 of file in6.h.

typedef struct in_addr in_addr_t

Type definition of the INET address.

See also:
in_addr

Definition at line 50 of file in.h.

typedef struct measured_string measured_string_t

Type definition of the character string with measured length.

See also:
measured_string

Definition at line 47 of file measured_strings.h.

typedef struct packet_dimension packet_dimension_t

Type definition of the packet dimension.

See also:
packet_dimension

Definition at line 53 of file packet.h.

typedef int packet_id_t

Packet identifier type.

Value zero is used as an invalid identifier.

Definition at line 43 of file packet.h.

typedef struct packet packet_t

Type definition of the packet.

See also:
packet

Definition at line 48 of file packet.h.

typedef struct sockaddr_in6 sockaddr_in6_t

Type definition of the INET6 socket address.

See also:
sockaddr_in6

Definition at line 55 of file in6.h.

typedef struct sockaddr_in sockaddr_in_t

Type definition of the INET socket address.

See also:
sockaddr_in

Definition at line 55 of file in.h.

typedef struct sockaddr sockaddr_t

Type definition of the socket address.

See also:
sockaddr

Definition at line 46 of file inet.h.

typedef struct socket socket_t

Type definition of the socket specific data.

See also:
socket

Definition at line 78 of file socket_client.c.


Enumeration Type Documentation

enum _buffer_state

Enumerator:
_bs_empty  Buffer is empty.
_bs_write  Buffer contains data to be written.
_bs_read  Buffer contains prefetched data for reading.

Definition at line 88 of file stdio.h.

enum _buffer_type

Enumerator:
_IONBF  No buffering.
_IOLBF  Line buffering.
_IOFBF  Full buffering.

Definition at line 79 of file stdio.h.

enum arp_messages

ARP module messages.

Enumerator:
NET_ARP_CLEAN_CACHE  Clean cache message.

See also:
arp_clean_cache()
NET_ARP_CLEAR_ADDRESS  Clear address cache message.

See also:
arp_clear_address_msg()
NET_ARP_CLEAR_DEVICE  Clear device cache message.

See also:
arp_clear_device_req()
NET_ARP_DEVICE  New device message.

See also:
arp_device_req()
NET_ARP_TRANSLATE  Address translation message.

See also:
arp_translate_req()

Definition at line 44 of file arp.h.

enum device_state

Device state.

Enumerator:
NETIF_NULL  Device not present or not initialized.
NETIF_STOPPED  Device present and stopped.
NETIF_ACTIVE  Device present and active.
NETIF_CARRIER_LOST  Device present but unable to transmit.

Definition at line 63 of file device.h.

enum icmp_messages_t

ICMP module messages.

Enumerator:
NET_ICMP_ECHO  Send echo request.

See also:
icmp_echo()
NET_ICMP_DEST_UNREACH  Send destination unreachable error message.

See also:
icmp_destination_unreachable_msg()
NET_ICMP_SOURCE_QUENCH  Send source quench error message.

See also:
icmp_source_quench_msg()
NET_ICMP_TIME_EXCEEDED  Send time exceeded error message.

See also:
icmp_time_exceeded_msg()
NET_ICMP_PARAMETERPROB  Send parameter problem error message.

See also:
icmp_parameter_problem_msg()

Definition at line 47 of file icmp.h.

enum il_messages

Internet layer modules messages.

Enumerator:
NET_IL_DEVICE_STATE  Device state changed message.

See also:
il_device_state_msg()
NET_IL_MTU_CHANGED  Device MTU changed message.

See also:
il_mtu_changed_msg()
NET_IL_RECEIVED  Packet received message.

See also:
il_received_msg()

Definition at line 45 of file il.h.

enum ip_messages

IP module messages.

Enumerator:
NET_IP_DEVICE  New device message.

See also:
ip_device_req()
NET_IP_ADD_ROUTE  Adds the routing entry.

See also:
ip_add_route()
NET_IP_GET_ROUTE  Gets the actual route information.

See also:
ip_get_route()
NET_IP_RECEIVED_ERROR  Processes the received error notification.

See also:
ip_received_error_msg()
NET_IP_SET_GATEWAY  Sets the default gateway.

See also:
ip_set_default_gateway()
NET_IP_PACKET_SPACE  Packet size message.

See also:
ip_packet_size_req()
NET_IP_SEND  Packet send message.

See also:
ip_send_msg()

Definition at line 46 of file ip.h.

enum keycode_t

Keycode definitions.

A keycode identifies a key by its position on the keyboard, rather than by its label. For human readability, key positions are noted with the key label on a keyboard with US layout. This label has nothing to do with the character, that the key produces -- this is determined by the keymap.

The keyboard model reflects a standard PC keyboard layout. Non-standard keyboards need to be mapped to this model in some logical way. Scancodes are mapped to keycodes with a scanmap.

For easier mapping to the model and to emphasize the nature of keycodes, they really are organized here by position, rather than by label.

Definition at line 53 of file keycode.h.

enum l18_win_locales_t

Windows locale IDs.

Codes taken from Developing International Software For Windows 95 and Windows NT by Nadine Kano (Microsoft Press). FIXME: add missing codes.

Definition at line 45 of file langs.h.

enum log_level_t

Enumerator:
LVL_LIMIT  For checking range of values.

Definition at line 39 of file log.h.

enum net_messages

Networking subsystem central module messages.

Enumerator:
NET_NET_GET_CONF  Returns the general configuration.

See also:
net_get_conf_req()
NET_NET_GET_DEVICE_CONF  Returns the device specific configuration.

See also:
net_get_device_conf_req()
NET_NET_STARTUP  Starts the networking stack.

Definition at line 44 of file net_net.h.

enum netif_messages

Network interface common module messages.

Enumerator:
NET_NETIF_PROBE  Probe device message.

See also:
netif_probe_req()
NET_NETIF_SEND  Send packet message.

See also:
netif_send_msg()
NET_NETIF_START  Start device message.

See also:
netif_start_req()
NET_NETIF_STATS  Get device usage statistics message.

See also:
netif_stats_req()
NET_NETIF_STOP  Stop device message.

See also:
netif_stop_req()
NET_NETIF_GET_ADDR  Get device address message.

See also:
netif_get_addr_req()

Definition at line 43 of file netif.h.

enum nil_messages

Network interface layer module messages.

Enumerator:
NET_NIL_DEVICE  New device or update MTU message.

See also:
nil_device_req()
NET_NIL_DEVICE_STATE  New device state message.

See also:
nil_device_state_msg()
NET_NIL_RECEIVED  Received packet queue message.

See also:
nil_received_msg()
NET_NIL_SEND  Send packet queue message.

See also:
nil_send_msg()
NET_NIL_PACKET_SPACE  Packet size message.

See also:
nil_packet_size_req()
NET_NIL_ADDR  Device local hardware address message.

See also:
nil_get_addr()
NET_NIL_BROADCAST_ADDR  Device broadcast hardware address message.

See also:
nil_get_broadcast_addr()

Definition at line 43 of file nil.h.

enum packet_messages

Packet server module messages.

Enumerator:
NET_PACKET_CREATE_1  Create packet message with specified content length.

See also:
packet_get_1()
NET_PACKET_CREATE_4  Create packet message with specified address length, prefix, content and suffix.

See also:
packet_get_4()
NET_PACKET_GET  Get packet message.

See also:
packet_return()
NET_PACKET_GET_SIZE  Get packet size message.

See also:
packet_translate()
NET_PACKET_RELEASE  Release packet message.

See also:
pq_release()

Definition at line 43 of file packet.h.

enum sock_type

Socket types.

Enumerator:
SOCK_STREAM  Stream (connection oriented) socket.
SOCK_DGRAM  Datagram (connectionless oriented) socket.
SOCK_RAW  Raw socket.

Definition at line 65 of file socket_codes.h.

enum socket_messages

Socket client messages.

Enumerator:
NET_SOCKET  Creates a new socket.

See also:
socket()
NET_SOCKET_BIND  Binds the socket.

See also:
bind()
NET_SOCKET_LISTEN  Creates a new socket.

See also:
socket()
NET_SOCKET_ACCEPT  Accepts an incomming connection.

See also:
accept()
NET_SOCKET_CONNECT  Connects the socket.

See also:
connect()
NET_SOCKET_CLOSE  Closes the socket.

See also:
closesocket()
NET_SOCKET_SEND  Sends data via the stream socket.

See also:
send()
NET_SOCKET_SENDTO  Sends data via the datagram socket.

See also:
sendto()
NET_SOCKET_RECV  Receives data from the stream socket.

See also:
socket()
NET_SOCKET_RECVFROM  Receives data from the datagram socket.

See also:
socket()
NET_SOCKET_GETSOCKOPT  Gets the socket option.

See also:
getsockopt()
NET_SOCKET_SETSOCKOPT  Sets the socket option.

See also:
setsockopt()
NET_SOCKET_ACCEPTED  New socket for acceptence notification message.
NET_SOCKET_RECEIVED  New data received notification message.
NET_SOCKET_DATA_FRAGMENT_SIZE  New socket data fragment size notification message.

Definition at line 43 of file socket.h.

enum tl_messages

Transport layer modules messages.

Enumerator:
NET_TL_RECEIVED  Packet received message.

See also:
tl_received_msg()

Definition at line 44 of file tl.h.


Function Documentation

void __async_sess_init ( void   ) 

Initialize the async_sess subsystem.

Needs to be called prior to any other interface in this file.

Definition at line 143 of file async_sess.c.

tcb_t * __make_tls ( void   ) 

Create TLS (Thread Local Storage) data structures.

The code requires, that sections .tdata and .tbss are adjacent. It may be changed in the future.

Returns:
Pointer to TCB.

Definition at line 52 of file tls.c.

void __malloc_init ( void   ) 

Initialize the heap allocator.

Create initial heap memory area. This routine is only called from libc initialization, thus we do not take any locks.

Definition at line 499 of file malloc.c.

sysarg_t __syscall ( const sysarg_t  p1,
const sysarg_t  p2,
const sysarg_t  p3,
const sysarg_t  p4,
const sysarg_t  p5,
const sysarg_t  p6,
const syscall_t  id 
)

Syscall routine.

Stores p1-p4, id to r0-r4 registers and calls swi instruction. Returned value is read from r0 register.

Parameters:
p1 Parameter 1.
p2 Parameter 2.
p3 Parameter 3.
p4 Parameter 4.
id Number of syscall.
Returns:
Syscall return value.

Definition at line 35 of file syscall.c.

void __thread_main ( uspace_arg_t *  uarg  ) 

Main thread function.

This function is called from __thread_entry() and is used to call the thread's implementing function and perform cleanup and exit when thread returns back.

Parameters:
uarg Pointer to userspace argument structure.

Definition at line 58 of file thread.c.

static size_t _fread ( void *  buf,
size_t  size,
size_t  nmemb,
FILE stream 
) [static]

Read from a stream (unbuffered).

Parameters:
buf Destination buffer.
size Size of each record.
nmemb Number of records to read.
stream Pointer to the stream.

Definition at line 356 of file io.c.

static size_t _fwrite ( const void *  buf,
size_t  size,
size_t  nmemb,
FILE stream 
) [static]

Write to a stream (unbuffered).

Parameters:
buf Source buffer.
size Size of each record.
nmemb Number of records to write.
stream Pointer to the stream.

Definition at line 389 of file io.c.

static void _gsort ( void *  data,
size_t  cnt,
size_t  elem_size,
sort_cmp_t  cmp,
void *  arg,
void *  slot 
) [static]

Gnome sort.

Apply generic gnome sort algorithm on supplied data, using pre-allocated buffer.

Parameters:
data Pointer to data to be sorted.
cnt Number of elements to be sorted.
elem_size Size of one element.
cmp Comparator function.
arg 3rd argument passed to cmp.
slot Pointer to scratch memory buffer elem_size bytes long.

Definition at line 73 of file sort.c.

static void _qsort ( void *  data,
size_t  cnt,
size_t  elem_size,
sort_cmp_t  cmp,
void *  arg,
void *  slot,
void *  pivot 
) [static]

Quicksort.

Apply generic quicksort algorithm on supplied data, using pre-allocated buffers.

Parameters:
data Pointer to data to be sorted.
cnt Number of elements to be sorted.
elem_size Size of one element.
cmp Comparator function.
arg 3rd argument passed to cmp.
slot Pointer to scratch memory buffer elem_size bytes long.
pivot Pointer to scratch memory buffer elem_size bytes long.

Definition at line 108 of file sort.c.

static unsigned long _strtoul ( const char *  nptr,
char **  endptr,
int  base,
char *  sgn 
) [static]

Convert string to a number.

Core of strtol and strtoul functions.

Parameters:
nptr Pointer to string.
endptr If not NULL, function stores here pointer to the first invalid character.
base Zero or number between 2 and 36 inclusive.
sgn It's set to 1 if minus found.
Returns:
Result of conversion.

Definition at line 778 of file str.c.

int accept ( int  socket_id,
struct sockaddr cliaddr,
socklen_t addrlen 
)

Accepts waiting socket.

Blocks until such a socket exists.

Parameters:
[in] socket_id Socket identifier.
[out] cliaddr The remote client address.
[in] addrlen The address length.
Returns:
EOK on success.

EBADMEM if the cliaddr or addrlen parameter is NULL.

EINVAL if the backlog parameter is not positive (<=0).

ENOTSOCK if the socket is not found.

Other error codes as defined for the NET_SOCKET_ACCEPT message.

Definition at line 621 of file socket_client.c.

void answer_call ( ipc_callid_t  callid,
int  result,
ipc_call_t answer,
size_t  count 
)

Answer a call.

Parameters:
[in] callid Call identifier.
[in] result Message processing result.
[in] answer Message processing answer.
[in] count Number of answer parameters.

Definition at line 59 of file modules.c.

static void area_check ( void *  addr  )  [static]

Check a heap area structure.

Should be called only inside the critical section.

Parameters:
addr Address of the heap area.

Definition at line 265 of file malloc.c.

static bool area_create ( size_t  size  )  [static]

Create new heap area.

Should be called only inside the critical section.

Parameters:
size Size of the area.

Definition at line 283 of file malloc.c.

static bool area_grow ( heap_area_t area,
size_t  size 
) [static]

Try to enlarge a heap area.

Should be called only inside the critical section.

Parameters:
area Heap area to grow.
size Gross size to grow (bytes).
Returns:
True if successful.

Definition at line 332 of file malloc.c.

int arg_parse_string ( int  argc,
char **  argv,
int *  index,
char **  value,
int  offset 
)

Parse the next argument as a character string.

The actual argument is pointed by the index. Parse the offseted actual argument value if the offset is set or the next one if not. Increment the actual index by the number of processed arguments.

Parameters:
[in] argc The total number of arguments.
[in] argv The arguments.
[in,out] index The actual argument index. The index is incremented by the number of processed arguments.
[out] value The parsed argument value.
[in] offset The value offset in the actual argument. If not set, the next argument is parsed instead.
Returns:
EOK on success.

ENOENT if the parameter is missing.

Definition at line 137 of file arg_parse.c.

int as_area_change_flags ( void *  address,
unsigned int  flags 
)

Change address-space area flags.

Parameters:
address Virtual address pointing into the address space area being modified.
flags New flags describing type of the area.
Returns:
zero on success or a code from errno.h on failure.

Definition at line 98 of file as.c.

void * as_area_create ( void *  address,
size_t  size,
unsigned int  flags 
)

Create address space area.

Parameters:
address Virtual address where to place new address space area.
size Size of the area.
flags Flags describing type of the area.
Returns:
address on success, (void *) -1 otherwise.

Definition at line 54 of file as.c.

int as_area_destroy ( void *  address  ) 

Destroy address space area.

Parameters:
address Virtual address pointing into the address space area being destroyed.
Returns:
zero on success or a code from errno.h on failure.

Definition at line 84 of file as.c.

int as_area_resize ( void *  address,
size_t  size,
unsigned int  flags 
)

Resize address space area.

Parameters:
address Virtual address pointing into already existing address space area.
size New requested size of the area.
flags Currently unused.
Returns:
zero on success or a code from errno.h on failure.

Definition at line 70 of file as.c.

void * as_get_mappable_page ( size_t  size  ) 

Return pointer to unmapped address space area.

Parameters:
size Requested size of the allocation.
Returns:
Pointer to the beginning of unmapped address space area.

Definition at line 111 of file as.c.

int as_get_physical_mapping ( void *  address,
uintptr_t frame 
)

Find mapping to physical address.

Parameters:
address Virtual address in question (virtual).
[out] frame Frame address (physical).
Returns:
Error code.
Return values:
EOK No error, frame holds the translation.
ENOENT Mapping not found.

Definition at line 125 of file as.c.

bool ascii_check ( wchar_t  ch  ) 

Check whether character is plain ASCII.

Returns:
True if character is plain ASCII.

Definition at line 360 of file str.c.

int int asprintf ( char **  strp,
const char *  fmt,
  ... 
)

Allocate and print to string.

Parameters:
strp Address of the pointer where to store the address of the newly allocated string. Format string.
Returns:
Number of characters printed or a negative error code.

Definition at line 61 of file asprintf.c.

int async_connect_me_to ( int  phone,
sysarg_t  arg1,
sysarg_t  arg2,
sysarg_t  arg3 
)

Wrapper for making IPC_M_CONNECT_ME_TO calls using the async framework.

Ask through phone for a new connection to some service.

Parameters:
phone Phone handle used for contacting the other side.
arg1 User defined argument.
arg2 User defined argument.
arg3 User defined argument.
Returns:
New phone handle on success or a negative error code.

Definition at line 1371 of file async.c.

int async_connect_me_to_blocking ( int  phoneid,
sysarg_t  arg1,
sysarg_t  arg2,
sysarg_t  arg3 
)

Wrapper for making IPC_M_CONNECT_ME_TO calls using the async framework.

Ask through phone for a new connection to some service and block until success.

Parameters:
phoneid Phone handle used for contacting the other side.
arg1 User defined argument.
arg2 User defined argument.
arg3 User defined argument.
Returns:
New phone handle on success or a negative error code.

Definition at line 1397 of file async.c.

int async_connect_to_me ( int  phone,
sysarg_t  arg1,
sysarg_t  arg2,
sysarg_t  arg3,
async_client_conn_t  client_receiver 
)

Wrapper for making IPC_M_CONNECT_TO_ME calls using the async framework.

Ask through phone for a new connection to some service.

Parameters:
phone Phone handle used for contacting the other side.
arg1 User defined argument.
arg2 User defined argument.
arg3 User defined argument.
client_receiver Connection handing routine.
Returns:
New phone handle on success or a negative error code.

Definition at line 1342 of file async.c.

aid_t async_data_read ( int  phoneid,
void *  dst,
size_t  size,
ipc_call_t dataptr 
)

Start IPC_M_DATA_READ using the async framework.

Parameters:
phoneid Phone that will be used to contact the receiving side.
dst Address of the beginning of the destination buffer.
size Size of the destination buffer (in bytes).
dataptr Storage of call data (arg 2 holds actual data size).
Returns:
Hash of the sent message or 0 on error.

Definition at line 1579 of file async.c.

int async_data_read_finalize ( ipc_callid_t  callid,
const void *  src,
size_t  size 
)

Wrapper for answering the IPC_M_DATA_READ calls using the async framework.

This wrapper only makes it more comfortable to answer IPC_M_DATA_READ calls so that the user doesn't have to remember the meaning of each IPC argument.

Parameters:
callid Hash of the IPC_M_DATA_READ call to answer.
src Source address for the IPC_M_DATA_READ call.
size Size for the IPC_M_DATA_READ call. Can be smaller than the maximum size announced by the sender.
Returns:
Zero on success or a value from errno.h on failure.

Definition at line 1646 of file async.c.

bool async_data_read_receive ( ipc_callid_t callid,
size_t size 
)

Wrapper for receiving the IPC_M_DATA_READ calls using the async framework.

This wrapper only makes it more comfortable to receive IPC_M_DATA_READ calls so that the user doesn't have to remember the meaning of each IPC argument.

So far, this wrapper is to be used from within a connection fibril.

Parameters:
callid Storage for the hash of the IPC_M_DATA_READ.
size Storage for the maximum size. Can be NULL.
Returns:
True on success, false on failure.

Definition at line 1616 of file async.c.

int async_data_read_start_generic ( int  phoneid,
void *  dst,
size_t  size,
int  flags 
)

Wrapper for IPC_M_DATA_READ calls using the async framework.

Parameters:
phoneid Phone that will be used to contact the receiving side.
dst Address of the beginning of the destination buffer.
size Size of the destination buffer.
flags Flags to control the data transfer.
Returns:
Zero on success or a negative error code from errno.h.

Definition at line 1596 of file async.c.

int async_data_write_accept ( void **  data,
const bool  nullterm,
const size_t  min_size,
const size_t  max_size,
const size_t  granularity,
size_t received 
)

Wrapper for receiving binary data or strings.

This wrapper only makes it more comfortable to use async_data_write_* functions to receive binary data or strings.

Parameters:
data Pointer to data pointer (which should be later disposed by free()). If the operation fails, the pointer is not touched.
nullterm If true then the received data is always zero terminated. This also causes to allocate one extra byte beyond the raw transmitted data.
min_size Minimum size (in bytes) of the data to receive.
max_size Maximum size (in bytes) of the data to receive. 0 means no limit.
granulariy If non-zero then the size of the received data has to be divisible by this value.
received If not NULL, the size of the received data is stored here.
Returns:
Zero on success or a value from errno.h on failure.

Definition at line 1771 of file async.c.

int async_data_write_finalize ( ipc_callid_t  callid,
void *  dst,
size_t  size 
)

Wrapper for answering the IPC_M_DATA_WRITE calls using the async framework.

This wrapper only makes it more comfortable to answer IPC_M_DATA_WRITE calls so that the user doesn't have to remember the meaning of each IPC argument.

Parameters:
callid Hash of the IPC_M_DATA_WRITE call to answer.
dst Final destination address for the IPC_M_DATA_WRITE call.
size Final size for the IPC_M_DATA_WRITE call.
Returns:
Zero on success or a value from errno.h on failure.

Definition at line 1745 of file async.c.

bool async_data_write_receive ( ipc_callid_t callid,
size_t size 
)

Wrapper for receiving the IPC_M_DATA_WRITE calls using the async framework.

This wrapper only makes it more comfortable to receive IPC_M_DATA_WRITE calls so that the user doesn't have to remember the meaning of each IPC argument.

So far, this wrapper is to be used from within a connection fibril.

Parameters:
callid Storage for the hash of the IPC_M_DATA_WRITE.
size Storage for the suggested size. May be NULL.
Returns:
True on success, false on failure.

Definition at line 1716 of file async.c.

int async_data_write_start_generic ( int  phoneid,
const void *  src,
size_t  size,
int  flags 
)

Wrapper for IPC_M_DATA_WRITE calls using the async framework.

Parameters:
phoneid Phone that will be used to contact the receiving side.
src Address of the beginning of the source buffer.
size Size of the source buffer.
flags Flags to control the data transfer.
Returns:
Zero on success or a negative error code from errno.h.

Definition at line 1695 of file async.c.

void async_data_write_void ( sysarg_t  retval  ) 

Wrapper for voiding any data that is about to be received.

This wrapper can be used to void any pending data

Parameters:
retval Error value from errno.h to be returned to the caller.

Definition at line 1832 of file async.c.

int async_exchange_begin ( async_sess_t sess  ) 

Start new exchange in a session.

Parameters:
sess_phone Session.
Returns:
Phone representing the new exchange or a negative error code.

Definition at line 224 of file async_sess.c.

void async_exchange_end ( async_sess_t sess,
int  data_phone 
)

Finish an exchange.

Parameters:
sess Session.
data_phone Phone representing the exchange within the session.

Definition at line 284 of file async_sess.c.

ipc_callid_t async_get_call_timeout ( ipc_call_t call,
suseconds_t  usecs 
)

Return new incoming message for the current (fibril-local) connection.

Parameters:
call Storage where the incoming call data will be stored.
usecs Timeout in microseconds. Zero denotes no timeout.
Returns:
If no timeout was specified, then a hash of the incoming call is returned. If a timeout is specified, then a hash of the incoming call is returned unless the timeout expires prior to receiving a message. In that case zero is returned.

Definition at line 458 of file async.c.

int async_hangup ( int  phone  ) 

Wrapper for ipc_hangup.

Parameters:
phone Phone handle to hung up.
Returns:
Zero on success or a negative error code.

Definition at line 1425 of file async.c.

void async_insert_timeout ( awaiter_t wd  ) 

Sort in current fibril's timeout request.

Parameters:
wd Wait data of the current fibril.

Definition at line 314 of file async.c.

static int async_manager_fibril ( void *  arg  )  [static]

Function to start async_manager as a standalone fibril.

When more kernel threads are used, one async manager should exist per thread.

Parameters:
arg Unused.
Returns:
Never returns.

Definition at line 849 of file async.c.

static int async_manager_worker ( void   )  [static]

Endless loop dispatching incoming calls and answers.

Returns:
Never returns.

Definition at line 786 of file async.c.

fid_t async_new_connection ( sysarg_t  in_task_hash,
sysarg_t  in_phone_hash,
ipc_callid_t  callid,
ipc_call_t call,
void(*)(ipc_callid_t, ipc_call_t *)  cfibril 
)

Create a new fibril for a new connection.

Create new fibril for connection, fill in connection structures and inserts it into the hash table, so that later we can easily do routing of messages to particular fibrils.

Parameters:
in_task_hash Identification of the incoming connection.
in_phone_hash Identification of the incoming connection.
callid Hash of the opening IPC_M_CONNECT_ME_TO call. If callid is zero, the connection was opened by accepting the IPC_M_CONNECT_TO_ME call and this function is called directly by the server.
call Call data of the opening call.
cfibril Fibril function that should be called upon opening the connection.
Returns:
New fibril id or NULL on failure.

Definition at line 665 of file async.c.

sysarg_t async_req_fast ( int  phoneid,
sysarg_t  method,
sysarg_t  arg1,
sysarg_t  arg2,
sysarg_t  arg3,
sysarg_t  arg4,
sysarg_t r1,
sysarg_t r2,
sysarg_t r3,
sysarg_t r4,
sysarg_t r5 
)

Pseudo-synchronous message sending - fast version.

Send message asynchronously and return only after the reply arrives.

This function can only transfer 4 register payload arguments. For transferring more arguments, see the slower async_req_slow().

Parameters:
phoneid Hash of the phone through which to make the call.
method Method of the call.
arg1 Service-defined payload argument.
arg2 Service-defined payload argument.
arg3 Service-defined payload argument.
arg4 Service-defined payload argument.
r1 If non-NULL, storage for the 1st reply argument.
r2 If non-NULL, storage for the 2nd reply argument.
r3 If non-NULL, storage for the 3rd reply argument.
r4 If non-NULL, storage for the 4th reply argument.
r5 If non-NULL, storage for the 5th reply argument.
Returns:
Return code of the reply or a negative error code.

Definition at line 1168 of file async.c.

sysarg_t async_req_slow ( int  phoneid,
sysarg_t  method,
sysarg_t  arg1,
sysarg_t  arg2,
sysarg_t  arg3,
sysarg_t  arg4,
sysarg_t  arg5,
sysarg_t r1,
sysarg_t r2,
sysarg_t r3,
sysarg_t r4,
sysarg_t r5 
)

Pseudo-synchronous message sending - slow version.

Send message asynchronously and return only after the reply arrives.

Parameters:
phoneid Hash of the phone through which to make the call.
method Method of the call.
arg1 Service-defined payload argument.
arg2 Service-defined payload argument.
arg3 Service-defined payload argument.
arg4 Service-defined payload argument.
arg5 Service-defined payload argument.
r1 If non-NULL, storage for the 1st reply argument.
r2 If non-NULL, storage for the 2nd reply argument.
r3 If non-NULL, storage for the 3rd reply argument.
r4 If non-NULL, storage for the 4th reply argument.
r5 If non-NULL, storage for the 5th reply argument.
Returns:
Return code of the reply or a negative error code.

Definition at line 1217 of file async.c.

aid_t async_send_fast ( int  phoneid,
sysarg_t  method,
sysarg_t  arg1,
sysarg_t  arg2,
sysarg_t  arg3,
sysarg_t  arg4,
ipc_call_t dataptr 
)

Send message and return id of the sent message.

The return value can be used as input for async_wait() to wait for completion.

Parameters:
phoneid Handle of the phone that will be used for the send.
method Service-defined method.
arg1 Service-defined payload argument.
arg2 Service-defined payload argument.
arg3 Service-defined payload argument.
arg4 Service-defined payload argument.
dataptr If non-NULL, storage where the reply data will be stored.
Returns:
Hash of the sent message or 0 on error.

Definition at line 944 of file async.c.

aid_t async_send_slow ( int  phoneid,
sysarg_t  method,
sysarg_t  arg1,
sysarg_t  arg2,
sysarg_t  arg3,
sysarg_t  arg4,
sysarg_t  arg5,
ipc_call_t dataptr 
)

Send message and return id of the sent message.

The return value can be used as input for async_wait() to wait for completion.

Parameters:
phoneid Handle of the phone that will be used for the send.
method Service-defined method.
arg1 Service-defined payload argument.
arg2 Service-defined payload argument.
arg3 Service-defined payload argument.
arg4 Service-defined payload argument.
arg5 Service-defined payload argument.
dataptr If non-NULL, storage where the reply data will be stored.
Returns:
Hash of the sent message or 0 on error.

Definition at line 987 of file async.c.

void async_session_create ( async_sess_t sess,
int  phone,
sysarg_t  arg1 
)

Create a session.

Session is a logical datapath from a client task to a server task. One session can accomodate multiple concurrent exchanges. Here phone is a phone connected to the desired server task.

This function always succeeds.

Parameters:
sess Session structure provided by caller, will be filled in.
phone Phone connected to the desired server task.
arg1 Value to pass as first argument upon creating a new connection. Typical use is to identify a resource within the server that the caller wants to access (port ID, interface ID, device ID, etc.).

Definition at line 165 of file async_sess.c.

void async_session_destroy ( async_sess_t sess  ) 

Destroy a session.

Dismantle session structure sess and release any resources (connections) held by the session.

Parameters:
sess Session to destroy.

Definition at line 184 of file async_sess.c.

void async_set_client_connection ( async_client_conn_t  conn  ) 

Setter for client_connection function pointer.

Parameters:
conn Function that will implement a new connection fibril.

Definition at line 1131 of file async.c.

void async_set_interrupt_received ( async_client_conn_t  intr  ) 

Setter for interrupt_received function pointer.

Parameters:
intr Function that will implement a new interrupt notification fibril.

Definition at line 1141 of file async.c.

int async_share_in_finalize ( ipc_callid_t  callid,
void *  src,
unsigned int  flags 
)

Wrapper for answering the IPC_M_SHARE_IN calls using the async framework.

This wrapper only makes it more comfortable to answer IPC_M_DATA_READ calls so that the user doesn't have to remember the meaning of each IPC argument.

Parameters:
callid Hash of the IPC_M_DATA_READ call to answer.
src Source address space base.
flags Flags to be used for sharing. Bits can be only cleared.
Returns:
Zero on success or a value from errno.h on failure.

Definition at line 1502 of file async.c.

bool async_share_in_receive ( ipc_callid_t callid,
size_t size 
)

Wrapper for receiving the IPC_M_SHARE_IN calls using the async framework.

This wrapper only makes it more comfortable to receive IPC_M_SHARE_IN calls so that the user doesn't have to remember the meaning of each IPC argument.

So far, this wrapper is to be used from within a connection fibril.

Parameters:
callid Storage for the hash of the IPC_M_SHARE_IN call.
size Destination address space area size.
Returns:
True on success, false on failure.

Definition at line 1474 of file async.c.

int async_share_in_start ( int  phoneid,
void *  dst,
size_t  size,
sysarg_t  arg,
unsigned int *  flags 
)

Wrapper for IPC_M_SHARE_IN calls using the async framework.

Parameters:
phoneid Phone that will be used to contact the receiving side.
dst Destination address space area base.
size Size of the destination address space area.
arg User defined argument.
flags Storage for the received flags. Can be NULL.
Returns:
Zero on success or a negative error code from errno.h.

Definition at line 1447 of file async.c.

int async_share_out_finalize ( ipc_callid_t  callid,
void *  dst 
)

Wrapper for answering the IPC_M_SHARE_OUT calls using the async framework.

This wrapper only makes it more comfortable to answer IPC_M_SHARE_OUT calls so that the user doesn't have to remember the meaning of each IPC argument.

Parameters:
callid Hash of the IPC_M_DATA_WRITE call to answer.
dst Destination address space area base address.
Returns:
Zero on success or a value from errno.h on failure.

Definition at line 1566 of file async.c.

bool async_share_out_receive ( ipc_callid_t callid,
size_t size,
unsigned int *  flags 
)

Wrapper for receiving the IPC_M_SHARE_OUT calls using the async framework.

This wrapper only makes it more comfortable to receive IPC_M_SHARE_OUT calls so that the user doesn't have to remember the meaning of each IPC argument.

So far, this wrapper is to be used from within a connection fibril.

Parameters:
callid Storage for the hash of the IPC_M_SHARE_OUT call.
size Storage for the source address space area size.
flags Storage for the sharing flags.
Returns:
True on success, false on failure.

Definition at line 1537 of file async.c.

int async_share_out_start ( int  phoneid,
void *  src,
unsigned int  flags 
)

Wrapper for IPC_M_SHARE_OUT calls using the async framework.

Parameters:
phoneid Phone that will be used to contact the receiving side.
src Source address space area base address.
flags Flags to be used for sharing. Bits can be only cleared.
Returns:
Zero on success or a negative error code from errno.h.

Definition at line 1516 of file async.c.

void async_usleep ( suseconds_t  timeout  ) 

Wait for specified time.

The current fibril is suspended but the thread continues to execute.

Parameters:
timeout Duration of the wait in microseconds.

Definition at line 1101 of file async.c.

void async_wait_for ( aid_t  amsgid,
sysarg_t retval 
)

Wait for a message sent by the async framework.

Parameters:
amsgid Hash of the message to wait for.
retval Pointer to storage where the retval of the answer will be stored.

Definition at line 1020 of file async.c.

int async_wait_timeout ( aid_t  amsgid,
sysarg_t retval,
suseconds_t  timeout 
)

Wait for a message sent by the async framework, timeout variant.

Parameters:
amsgid Hash of the message to wait for.
retval Pointer to storage where the retval of the answer will be stored.
timeout Timeout in microseconds.
Returns:
Zero on success, ETIMEOUT if the timeout has expired.

Definition at line 1056 of file async.c.

int bcmp ( const void *  s1,
const void *  s2,
size_t  len 
)

Compare two memory areas.

Parameters:
s1 Pointer to the first area to compare.
s2 Pointer to the second area to compare.
len Size of the first area in bytes. Both areas must have the same length.
Returns:
If len is 0, return zero. If the areas match, return zero. Otherwise return non-zero.

Definition at line 233 of file mem.c.

int bind ( int  socket_id,
const struct sockaddr my_addr,
socklen_t  addrlen 
)

Binds the socket to a port address.

Parameters:
[in] socket_id Socket identifier.
[in] my_addr The port address.
[in] addrlen The address length.
Returns:
EOK on success.

ENOTSOCK if the socket is not found.

EBADMEM if the my_addr parameter is NULL.

NO_DATA if the addlen parameter is zero.

Other error codes as defined for the NET_SOCKET_BIND message.

Definition at line 562 of file socket_client.c.

int bind_service ( services_t  need,
sysarg_t  arg1,
sysarg_t  arg2,
sysarg_t  arg3,
async_client_conn_t  client_receiver 
)

Create bidirectional connection with the needed module service and registers the message receiver.

Parameters:
[in] need The needed module service.
[in] arg1 The first parameter.
[in] arg2 The second parameter.
[in] arg3 The third parameter.
[in] client_receiver The message receiver.
Returns:
The phone of the needed service.

Other error codes as defined for the ipc_connect_to_me() function.

Definition at line 110 of file modules.c.

int bind_service_timeout ( services_t  need,
sysarg_t  arg1,
sysarg_t  arg2,
sysarg_t  arg3,
async_client_conn_t  client_receiver,
suseconds_t  timeout 
)

Create bidirectional connection with the needed module service and registers the message receiver.

Parameters:
[in] need The needed module service.
[in] arg1 The first parameter.
[in] arg2 The second parameter.
[in] arg3 The third parameter.
[in] client_receiver The message receiver.
[in] timeout The connection timeout in microseconds. No timeout if set to zero (0).
Returns:
The phone of the needed service.

ETIMEOUT if the connection timeouted.

Other error codes as defined for the ipc_connect_to_me() function.

Definition at line 133 of file modules.c.

static void block_check ( void *  addr  )  [static]

Check a heap block.

Verifies that the structures related to a heap block still contain the magic constants. This helps detect heap corruption early on. Should be called only inside the critical section.

Parameters:
addr Address of the block.

Definition at line 246 of file malloc.c.

static void block_init ( void *  addr,
size_t  size,
bool  free,
heap_area_t area 
) [static]

Initialize a heap block.

Fill in the structures related to a heap block. Should be called only inside the critical section.

Parameters:
addr Address of the block.
size Size of the block including the header and the footer.
free Indication of a free block.
area Heap area the block belongs to.

Definition at line 221 of file malloc.c.

void * calloc ( const size_t  nmemb,
const size_t  size 
)

Allocate memory by number of elements.

Parameters:
nmemb Number of members to allocate.
size Size of one member in bytes.
Returns:
Allocated memory or NULL.

Definition at line 736 of file malloc.c.

char * canonify ( char *  path,
size_t lenp 
)

Canonify a file system path.

A file system path is canonical, if the following holds:

1) the path is absolute (i.e. a/b/c is not canonical) 2) there is no trailing slash in the path if it has components (i.e. /a/b/c/ is not canonical) 3) there is no extra slash in the path (i.e. /a//b/c is not canonical) 4) there is no '.' component in the path (i.e. /a/./b/c is not canonical) 5) there is no '..' component in the path (i.e. /a/b/../c is not canonical)

This function makes a potentially non-canonical file system path canonical. It works in-place and requires a NULL-terminated input string.

Parameters:
path Path to be canonified.
lenp Pointer where the length of the final path will be stored. Can be NULL.
Returns:
Canonified path or NULL on failure.

Definition at line 311 of file canonify.c.

int cap_grant ( task_id_t  id,
unsigned int  caps 
)

Grant capabilities to a task.

Parameters:
id Destination task ID.
caps Capabilities to grant.
Returns:
Zero on success or a value from errno.h on failure.

Definition at line 49 of file cap.c.

int cap_revoke ( task_id_t  id,
unsigned int  caps 
)

Revoke capabilities from a task.

Parameters:
id Destination task ID.
caps Capabilities to revoke.
Returns:
Zero on success or a value from errno.h on failure.

Definition at line 69 of file cap.c.

ssize_t char_dev_read ( int  dev_phone,
void *  buf,
size_t  size 
)

Read from character device.

Parameters:
dev_phone Phone to the device.
buf Output buffer for the data read from the device.
size Maximum size (in bytes) of the data to be read.
Returns:
Non-negative number of bytes actually read from the device on success, negative error number otherwise.

Definition at line 103 of file char_dev.c.

static ssize_t char_dev_rw ( int  dev_phone,
void *  buf,
size_t  size,
bool  read 
) [static]

Read to or write from device.

Helper function to read to or write from a device using its character interface.

Parameters:
dev_phone Phone to the device.
buf Buffer for the data read from or written to the device.
size Maximum size of data (in bytes) to be read or written.
read Read from the device if true, write to it otherwise.
Returns:
Non-negative number of bytes actually read from or written to the device on success, negative error number otherwise.

Definition at line 56 of file char_dev.c.

ssize_t char_dev_write ( int  dev_phone,
void *  buf,
size_t  size 
)

Write to character device.

Parameters:
dev_phone Phone to the device.
buf Input buffer containg the data to be written to the device.
size Maximum size (in bytes) of the data to be written.
Returns:
Non-negative number of bytes actually written to the device on success, negative error number otherwise.

Definition at line 118 of file char_dev.c.

int char_map_add ( char_map_t map,
const uint8_t *  identifier,
size_t  length,
const int  value 
)

Adds the value with the key to the map.

Parameters:
[in,out] map The character string to integer map.
[in] identifier The key zero ('') terminated character string. The key character string is processed until the first terminating zero ('') character after the given length is found.
[in] length The key character string length. The parameter may be zero (0) which means that the string is processed until the terminating zero ('\0') character is found.
[in] value The integral value to be stored for the key character string.
Returns:
EOK on success.

EINVAL if the map is not valid.

EINVAL if the identifier parameter is NULL.

EINVAL if the length parameter zero (0) and the identifier parameter is an empty character string (the first character is the terminating zero ('') character.

EEXIST if the key character string is already used.

Other error codes as defined for the char_map_add_item() function.

Definition at line 141 of file char_map.c.

static int char_map_add_item ( char_map_t map,
const uint8_t *  identifier,
size_t  length,
const int  value 
) [static]

Adds the value with the key to the map.

Creates new nodes to map the key.

Parameters:
[in,out] map The character string to integer map.
[in] identifier The key zero ('') terminated character string. The key character string is processed until the first terminating zero ('') character after the given length is found.
[in] length The key character string length. The parameter may be zero (0) which means that the string is processed until the terminating zero ('') character is found.
[in] value The integral value to be stored for the key character string.
Returns:
EOK on success.

ENOMEM if there is not enough memory left.

EEXIST if the key character string is already used.

Definition at line 67 of file char_map.c.

void char_map_destroy ( char_map_t map  ) 

Clears and destroys the map.

Parameters:
[in,out] map The character string to integer map.

Definition at line 173 of file char_map.c.

int char_map_exclude ( char_map_t map,
const uint8_t *  identifier,
size_t  length 
)

Excludes the value assigned to the key from the map.

The entry is cleared from the map.

Parameters:
[in,out] map The character string to integer map.
[in] identifier The key zero ('') terminated character string. The key character string is processed until the first terminating zero ('') character after the given length is found.
[in] length The key character string length. The parameter may be zero (0) which means that the string is processed until the terminating zero ('') character is found.
Returns:
The integral value assigned to the key character string.

CHAR_MAP_NULL if the key is not assigned a value.

Definition at line 243 of file char_map.c.

int char_map_find ( const char_map_t map,
const uint8_t *  identifier,
size_t  length 
)

Returns the value assigned to the key from the map.

Parameters:
[in] map The character string to integer map.
[in] identifier The key zero ('') terminated character string. The key character string is processed until the first terminating zero ('') character after the given length is found.
[in] length The key character string length. The parameter may be zero (0) which means that the string is processed until the terminating zero ('') character is found.
Returns:
The integral value assigned to the key character string.

CHAR_MAP_NULL if the key is not assigned a value.

Definition at line 271 of file char_map.c.

static char_map_t* char_map_find_node ( const char_map_t map,
const uint8_t *  identifier,
size_t  length 
) [static]

Returns the node assigned to the key from the map.

Parameters:
[in] map The character string to integer map.
[in] identifier The key zero ('') terminated character string. The key character string is processed until the first terminating zero ('') character after the given length is found.
[in] length The key character string length. The parameter may be zero (0) which means that the string is processed until the terminating zero ('') character is found.
Returns:
The node holding the integral value assigned to the key character string.

NULL if the key is not assigned a node.

Definition at line 202 of file char_map.c.

int char_map_initialize ( char_map_t map  ) 

Initializes the map.

Parameters:
[in,out] map The character string to integer map.
Returns:
EOK on success.

EINVAL if the map parameter is NULL.

ENOMEM if there is not enough memory left.

Definition at line 286 of file char_map.c.

static int char_map_is_valid ( const char_map_t map  )  [static]

Checks if the map is valid.

Parameters:
[in] map The character string to integer map.
Returns:
TRUE if the map is valid.

FALSE otherwise.

Definition at line 112 of file char_map.c.

int char_map_update ( char_map_t map,
const uint8_t *  identifier,
const size_t  length,
const int  value 
)

Adds or updates the value with the key to the map.

Parameters:
[in,out] map The character string to integer map.
[in] identifier The key zero ('') terminated character string. The key character string is processed until the first terminating zero ('') character after the given length is found.
[in] length The key character string length. The parameter may be zero (0) which means that the string is processed until the terminating zero ('') character is found.
[in] value The integral value to be stored for the key character string.
Returns:
EOK on success.

EINVAL if the map is not valid.

EINVAL if the identifier parameter is NULL.

EINVAL if the length parameter zero (0) and the identifier parameter is an empty character string (the first character is the terminating zero (') character.

EEXIST if the key character string is already used.

Other error codes as defined for the char_map_add_item() function.

Definition at line 331 of file char_map.c.

bool chr_check ( wchar_t  ch  ) 

Check whether character is valid.

Returns:
True if character is a valid Unicode code point.

Definition at line 373 of file str.c.

int chr_encode ( const wchar_t  ch,
char *  str,
size_t offset,
size_t  size 
)

Encode a single character to string representation.

Encode a single character to string representation (i.e. UTF-8) and store it into a buffer at offset. Encoding starts at offset and this offset is moved to the position where the next character can be written to.

Parameters:
ch Input character.
str Output buffer.
offset Byte offset where to start writing.
size Size of the output buffer (in bytes).
Returns:
EOK if the character was encoded successfully, EOVERFLOW if there was not enough space in the output buffer or EINVAL if the character code was invalid.

Definition at line 144 of file str.c.

int clipboard_get_str ( char **  str  ) 

Get a copy of clipboard contents.

Returns a new string that can be deallocated with free().

Parameters:
str Here pointer to the newly allocated string is stored.
Returns:
Zero on success or negative error code.

Definition at line 115 of file clipboard.c.

int clipboard_put_str ( const char *  str  ) 

Copy string to clipboard.

Sets the clipboard contents to str. Passing an empty string or NULL makes the clipboard empty.

Parameters:
str String to put to clipboard or NULL.
Returns:
Zero on success or negative error code.

Definition at line 70 of file clipboard.c.

int closesocket ( int  socket_id  ) 

Closes the socket.

Parameters:
[in] socket_id Socket identifier.
Returns:
EOK on success.

ENOTSOCK if the socket is not found.

EINPROGRESS if there is another blocking function in progress.

Other error codes as defined for the NET_SOCKET_CLOSE message.

Definition at line 764 of file socket_client.c.

static int conn_compare ( unsigned long  key[],
hash_count_t  keys,
link_t item 
) [static]

Compare hash table item with a key.

Parameters:
key Array containing the source phone hash as the only item.
keys Expected 1 but ignored.
item Connection hash table item.
Returns:
True on match, false otherwise.

Definition at line 292 of file async.c.

static hash_index_t conn_hash ( unsigned long  key[]  )  [static]

Compute hash into the connection hash table based on the source phone hash.

Parameters:
key Pointer to source phone hash.
Returns:
Index into the connection hash table.

Definition at line 277 of file async.c.

int connect ( int  socket_id,
const struct sockaddr serv_addr,
socklen_t  addrlen 
)

Connects socket to the remote server.

Parameters:
[in] socket_id Socket identifier.
[in] serv_addr The remote server address.
[in] addrlen The address length.
Returns:
EOK on success.

EBADMEM if the serv_addr parameter is NULL.

NO_DATA if the addlen parameter is zero.

ENOTSOCK if the socket is not found.

Other error codes as defined for the NET_SOCKET_CONNECT message.

Definition at line 724 of file socket_client.c.

int connect_to_service ( services_t  need  ) 

Connects to the needed module.

Parameters:
[in] need The needed module service.
Returns:
The phone of the needed service.

Definition at line 155 of file modules.c.

int connect_to_service_timeout ( services_t  need,
suseconds_t  timeout 
)

Connects to the needed module.

Parameters:
[in] need The needed module service.
[in] timeout The connection timeout in microseconds. No timeout if set to zero (0).
Returns:
The phone of the needed service.

ETIMEOUT if the connection timeouted.

Definition at line 168 of file modules.c.

static int connection_fibril ( void *  arg  )  [static]

Wrapper for client connection fibril.

When a new connection arrives, a fibril with this implementing function is created. It calls client_connection() and does the final cleanup.

Parameters:
arg Connection structure pointer.
Returns:
Always zero.

Definition at line 541 of file async.c.

int data_reply ( void *  data,
size_t  data_length 
)

Replies the data to the other party.

Parameters:
[in] data The data buffer to be sent.
[in] data_length The buffer length.
Returns:
EOK on success.

EINVAL if the client does not expect the data.

EOVERFLOW if the client does not expect all the data. Only partial data are transfered.

Other error codes as defined for the async_data_read_finalize() function.

Definition at line 203 of file modules.c.

static void default_client_connection ( ipc_callid_t  callid,
ipc_call_t call 
) [static]

Default fibril function that gets called to handle new connection.

This function is defined as a weak symbol - to be redefined in user code.

Parameters:
callid Hash of the incoming call.
call Data of the incoming call.

Definition at line 212 of file async.c.

static void default_interrupt_received ( ipc_callid_t  callid,
ipc_call_t call 
) [static]

Default fibril function that gets called to handle interrupt notifications.

This function is defined as a weak symbol - to be redefined in user code.

Parameters:
callid Hash of the incoming call.
call Data of the incoming call.

Definition at line 230 of file async.c.

int device_assign_devno ( void   ) 

Return unique device number.

Returns:
New unique device number.

Definition at line 49 of file ddi.c.

int devman_add_function ( const char *  name,
fun_type_t  ftype,
match_id_list_t match_ids,
devman_handle_t  devh,
devman_handle_t funh 
)

Add function to a device.

Request devman to add a new function to the specified device owned by this driver task.

Parameters:
name Name of the new function
ftype Function type, fun_inner or fun_exposed
match_ids Match IDs (should be empty for fun_exposed)
devh Devman handle of the device
funh Place to store handle of the new function
Returns:
EOK on success or negative error code.

Definition at line 171 of file devman.c.

int devmap_device_register ( const char *  fqdn,
devmap_handle_t handle 
)

Register new device.

Parameters:
fqdn Fully qualified device name.
handle Output: Handle to the created instance of device.

Definition at line 182 of file devmap.c.

int devmap_device_register_with_iface ( const char *  fqdn,
devmap_handle_t handle,
sysarg_t  interface 
)

Register new device.

The interface is used when forwarding connection to the driver. If not 0, the first argument is the interface and the second argument is the devmap handle of the device. When the interface is zero (default), the first argument is directly the handle (to ensure backward compatibility).

Parameters:
fqdn Fully qualified device name.
[out] handle Handle to the created instance of device.
interface Interface when forwarding.

Definition at line 139 of file devmap.c.

int dyn_fifo_destroy ( dyn_fifo_t fifo  ) 

Clears and destroys the queue.

Parameters:
[in,out] fifo The dynamic queue.
Returns:
EOK on success.

EINVAL if the queue is not valid.

Definition at line 195 of file dynamic_fifo.c.

int dyn_fifo_initialize ( dyn_fifo_t fifo,
int  size 
)

Initializes the dynamic queue.

Parameters:
[in,out] fifo The dynamic queue.
[in] size The initial queue size.
Returns:
EOK on success.

EINVAL if the queue is not valid.

EBADMEM if the fifo parameter is NULL.

ENOMEM if there is not enough memory left.

Definition at line 75 of file dynamic_fifo.c.

static int dyn_fifo_is_valid ( dyn_fifo_t fifo  )  [static]

Checks if the queue is valid.

Parameters:
[in] fifo The dynamic queue.
Returns:
TRUE if the queue is valid.

FALSE otherwise.

Definition at line 61 of file dynamic_fifo.c.

int dyn_fifo_pop ( dyn_fifo_t fifo  ) 

Returns and excludes the first item in the queue.

Parameters:
[in,out] fifo The dynamic queue.
Returns:
Value of the first item in the queue.

EINVAL if the queue is not valid.

ENOENT if the queue is empty.

Definition at line 156 of file dynamic_fifo.c.

int dyn_fifo_push ( dyn_fifo_t fifo,
int  value,
int  max_size 
)

Appends a new item to the queue end.

Parameters:
[in,out] fifo The dynamic queue.
[in] value The new item value. Should be positive.
[in] max_size The maximum queue size. The queue is not resized beyound this limit. May be zero or negative to indicate no limit.
Returns:
EOK on success.

EINVAL if the queue is not valid.

ENOMEM if there is not enough memory left.

Definition at line 106 of file dynamic_fifo.c.

int dyn_fifo_value ( dyn_fifo_t fifo  ) 

Returns and keeps the first item in the queue.

Parameters:
[in,out] fifo The dynamic queue.
Returns:
Value of the first item in the queue.

EINVAL if the queue is not valid.

ENOENT if the queue is empty.

Definition at line 178 of file dynamic_fifo.c.

int event_subscribe ( event_type_t  evno,
sysarg_t  imethod 
)

Subscribe event notifications.

Parameters:
evno Event type to subscribe.
imethod Use this interface and method for notifying me.
Returns:
Value returned by the kernel.

Definition at line 51 of file event.c.

int event_unmask ( event_type_t  evno  ) 

Unmask event notifications.

Parameters:
evno Event type to unmask.
Returns:
Value returned by the kernel.

Definition at line 64 of file event.c.

int fflush ( FILE stream  ) 

Definition at line 725 of file io.c.

void fibril_add_manager ( fid_t  fid  ) 

Add a fibril to the manager list.

Parameters:
fid Pointer to the fibril structure of the fibril to be added.

Definition at line 313 of file fibril.c.

void fibril_add_ready ( fid_t  fid  ) 

Add a fibril to the ready list.

Parameters:
fid Pointer to the fibril structure of the fibril to be added.

Definition at line 293 of file fibril.c.

fid_t fibril_create ( int(*)(void *)  func,
void *  arg 
)

Create a new fibril.

Parameters:
func Implementing function of the new fibril.
arg Argument to pass to func.
Returns:
0 on failure or TLS of the new fibril.

Definition at line 262 of file fibril.c.

fid_t fibril_get_id ( void   ) 

Return fibril id of the currently running fibril.

Returns:
fibril ID of the currently running fibril.

Definition at line 338 of file fibril.c.

void fibril_inc_sercount ( void   ) 

Disable preemption.

If the fibril wants to send several message in a row and does not want to be preempted, it should start async_serialize_start() in the beginning of communication and async_serialize_end() in the end. If it is a true multithreaded application, it should protect the communication channel by a futex as well.

Definition at line 352 of file fibril.c.

static void fibril_main ( void   )  [static]

Function that spans the whole life-cycle of a fibril.

Each fibril begins execution in this function. Then the function implementing the fibril logic is called. After its return, the return value is saved. The fibril then switches to another fibril, which cleans up after it.

Definition at line 82 of file fibril.c.

int fibril_switch ( fibril_switch_type_t  stype  ) 

Switch from the current fibril.

If calling with FIBRIL_TO_MANAGER parameter, the async_futex should be held.

Parameters:
stype Switch type. One of FIBRIL_PREEMPT, FIBRIL_TO_MANAGER, FIBRIL_FROM_MANAGER, FIBRIL_FROM_DEAD. The parameter describes the circumstances of the switch.
Returns:
0 if there is no ready fibril,

1 otherwise.

Definition at line 142 of file fibril.c.

FILE * fopen ( const char *  path,
const char *  mode 
)

Open a stream.

Parameters:
path Path of the file to open.
mode Mode string, (r|w|a)[b|t][+].

Definition at line 234 of file io.c.

int fprintf ( FILE stream,
const char *  fmt,
  ... 
)

Print formatted text.

Parameters:
stream Output stream
fmt Format string
See also:
For more details about format string see printf_core.

Definition at line 46 of file printf.c.

size_t fread ( void *  dest,
size_t  size,
size_t  nmemb,
FILE stream 
)

Read from a stream.

Parameters:
dest Destination buffer.
size Size of each record.
nmemb Number of records to read.
stream Pointer to the stream.

Definition at line 477 of file io.c.

void free ( const void *  addr  ) 

Free a memory block.

Parameters:
addr The address of the block.

Definition at line 873 of file malloc.c.

int futex_down ( futex_t futex  ) 

Down the futex.

Parameters:
futex Futex.
Returns:
ENOENT if there is no such virtual address.

Zero in the uncontended case.

Otherwise one of ESYNCH_OK_ATOMIC or ESYNCH_OK_BLOCKED.

Definition at line 73 of file futex.c.

void futex_initialize ( futex_t futex,
int  val 
)

Initialize futex counter.

Parameters:
futex Futex.
val Initialization value.

Definition at line 46 of file futex.c.

int futex_trydown ( futex_t futex  ) 

Try to down the futex.

Parameters:
futex Futex.
Returns:
Non-zero if the futex was acquired.

Zero if the futex was not acquired.

Definition at line 59 of file futex.c.

int futex_up ( futex_t futex  ) 

Up the futex.

Parameters:
futex Futex.
Returns:
ENOENT if there is no such virtual address.

Zero in the uncontended case.

Definition at line 89 of file futex.c.

size_t fwrite ( const void *  buf,
size_t  size,
size_t  nmemb,
FILE stream 
)

Write to a stream.

Parameters:
buf Source buffer.
size Size of each record.
nmemb Number of records to write.
stream Pointer to the stream.

Definition at line 545 of file io.c.

GENERIC_FIELD_DECLARE ( gpm  ,
packet_map_t   
)

Packet map.

Maps packet identifiers to the packet references.

See also:
generic_field.h

int getsockopt ( int  socket_id,
int  level,
int  optname,
void *  value,
size_t optlen 
)

Gets socket option.

Parameters:
[in] socket_id Socket identifier.
[in] level The socket options level.
[in] optname The socket option to be get.
[out] value The value buffer to be filled.
[in,out] optlen The value buffer length. The maximum length is read. The actual length is set.
Returns:
EOK on success.

ENOTSOCK if the socket is not found.

EBADMEM if the value or optlen parameter is NULL.

NO_DATA if the optlen parameter is zero.

Other error codes as defined for the NET_SOCKET_GETSOCKOPT message.

Definition at line 1170 of file socket_client.c.

int gettimeofday ( struct timeval tv,
struct timezone tz 
)

Get time of day.

The time variables are memory mapped (read-only) from kernel which updates them periodically.

As it is impossible to read 2 values atomically, we use a trick: First we read the seconds, then we read the microseconds, then we read the seconds again. If a second elapsed in the meantime, set the microseconds to zero.

This assures that the values returned by two subsequent calls to gettimeofday() are monotonous.

Definition at line 139 of file time.c.

bool gsort ( void *  data,
size_t  cnt,
size_t  elem_size,
sort_cmp_t  cmp,
void *  arg 
)

Gnome sort wrapper.

This is only a wrapper that takes care of memory allocations for storing the slot element for generic gnome sort algorithm.

Parameters:
data Pointer to data to be sorted.
cnt Number of elements to be sorted.
elem_size Size of one element.
cmp Comparator function.
arg 3rd argument passed to cmp.
Returns:
True if sorting succeeded.

Definition at line 155 of file sort.c.

static void handle_call ( ipc_callid_t  callid,
ipc_call_t call 
) [static]

Handle a call that was received.

If the call has the IPC_M_CONNECT_ME_TO method, a new connection is created. Otherwise the call is routed to its connection fibril.

Parameters:
callid Hash of the incoming call.
call Data of the incoming call.

Definition at line 721 of file async.c.

void hash_table_apply ( hash_table_t h,
void(*)(link_t *, void *)  f,
void *  arg 
)

Apply fucntion to all items in hash table.

Parameters:
h Hash table.
f Function to be applied.
arg Argument to be passed to the function.

Definition at line 202 of file hash_table.c.

bool hash_table_create ( hash_table_t h,
hash_count_t  m,
hash_count_t  max_keys,
hash_table_operations_t op 
)

Create chained hash table.

Parameters:
h Hash table structure. Will be initialized by this call.
m Number of hash table buckets.
max_keys Maximal number of keys needed to identify an item.
op Hash table operations structure.
Returns:
True on success

Definition at line 56 of file hash_table.c.

void hash_table_destroy ( hash_table_t h  ) 

Destroy a hash table instance.

Parameters:
h Hash table to be destroyed.

Definition at line 85 of file hash_table.c.

link_t * hash_table_find ( hash_table_t h,
unsigned long  key[] 
)

Search hash table for an item matching keys.

Parameters:
h Hash table.
key Array of all keys needed to compute hash index.
Returns:
Matching item on success, NULL if there is no such item.

Definition at line 118 of file hash_table.c.

void hash_table_insert ( hash_table_t h,
unsigned long  key[],
link_t item 
)

Insert item into a hash table.

Parameters:
h Hash table.
key Array of all keys necessary to compute hash index.
item Item to be inserted into the hash table.

Definition at line 99 of file hash_table.c.

void hash_table_remove ( hash_table_t h,
unsigned long  key[],
hash_count_t  keys 
)

Remove all matching items from hash table.

For each removed item, h->remove_callback() is called.

Parameters:
h Hash table.
key Array of keys that will be compared against items of the hash table.
keys Number of keys in the 'key' array.

Definition at line 149 of file hash_table.c.

static void headless_list_concat ( link_t part1,
link_t part2 
) [inline, static]

Concatenate two headless doubly-linked circular lists.

Concatenate two headless doubly-linked circular lists.

Parameters:
part1 Pointer to link_t structure leading the first headless list.
part2 Pointer to link_t structure leading the second headless list.

Definition at line 227 of file list.h.

static void headless_list_split ( link_t part1,
link_t part2 
) [inline, static]

Split headless doubly-linked circular list.

Split headless doubly-linked circular list.

Parameters:
part1 Pointer to link_t structure leading the first half of the headless list.
part2 Pointer to link_t structure leading the second half of the headless list.

Definition at line 212 of file list.h.

static void headless_list_split_or_concat ( link_t part1,
link_t part2 
) [inline, static]

Split or concatenate headless doubly-linked circular list.

Split or concatenate headless doubly-linked circular list.

Note that the algorithm works both directions: concatenates splitted lists and splits concatenated lists.

Parameters:
part1 Pointer to link_t structure leading the first (half of the headless) list.
part2 Pointer to link_t structure leading the second (half of the headless) list.

Definition at line 191 of file list.h.

static bool heap_grow ( size_t  size  )  [static]

Try to enlarge any of the heap areas.

Should be called only inside the critical section.

Parameters:
size Gross size of item to allocate (bytes).

Definition at line 371 of file malloc.c.

static void heap_shrink ( heap_area_t area  )  [static]

Try to shrink heap.

Should be called only inside the critical section. In all cases the next pointer is reset.

Parameters:
area Last modified heap area.

Definition at line 395 of file malloc.c.

int icmp_connect_module ( suseconds_t  timeout  ) 

Connect to the ICMP module.

Parameters:
[in] timeout Connection timeout in microseconds, zero for no timeout.
Returns:
ICMP module phone on success.

ETIMEOUT if the connection timeouted.

Definition at line 54 of file icmp_common.c.

int icmp_echo_msg ( int  icmp_phone,
size_t  size,
mseconds_t  timeout,
ip_ttl_t  ttl,
ip_tos_t  tos,
int  dont_fragment,
const struct sockaddr addr,
socklen_t  addrlen 
)

Requests an echo message.

Sends a packet with specified parameters to the target host and waits for the reply upto the given timeout. Blocks the caller until the reply or the timeout occurs.

Parameters:
[in] icmp_phone The ICMP module phone used for (semi)remote calls.
[in] size The message data length in bytes.
[in] timeout The timeout in milliseconds.
[in] ttl The time to live.
[in] tos The type of service.
[in] dont_fragment The value indicating whether the datagram must not be fragmented. Is used as a MTU discovery.
[in] addr The target host address.
[in] addrlen The torget host address length.
Returns:
ICMP_ECHO on success.

ETIMEOUT if the reply has not arrived before the timeout.

ICMP type of the received error notification.

EINVAL if the addrlen parameter is less or equal to zero.

ENOMEM if there is not enough memory left.

EPARTY if there was an internal error.

Definition at line 75 of file icmp_api.c.

int inet_ntop ( uint16_t  family,
const uint8_t *  data,
char *  address,
size_t  length 
)

Prints the address into the character buffer.

Parameters:
[in] family The address family.
[in] data The address data.
[out] address The character buffer to be filled.
[in] length The buffer length.
Returns:
EOK on success.

EINVAL if the data or address parameter is NULL.

ENOMEM if the character buffer is not long enough.

ENOTSUP if the address family is not supported.

Definition at line 59 of file inet.c.

int inet_pton ( uint16_t  family,
const char *  address,
uint8_t *  data 
)

Parses the character string into the address.

If the string is shorter than the full address, zero bytes are added.

Parameters:
[in] family The address family.
[in] address The character buffer to be parsed.
[out] data The address data to be filled.
Returns:
EOK on success.

EINVAL if the data parameter is NULL.

ENOENT if the address parameter is NULL.

ENOTSUP if the address family is not supported.

The base number of the values.

The number of bytes per a section.

The number of bytes of the address data.

Definition at line 108 of file inet.c.

INT_MAP_DECLARE ( sockets  ,
socket_t   
)

Sockets map.

Maps socket identifiers to the socket specific data.

See also:
int_map.h

int iospace_enable ( task_id_t  id,
void *  ioaddr,
unsigned long  size 
)

Enable I/O space range to task.

Caller of this function must have the IO_MEM_MANAGER capability.

Parameters:
id Task ID.
ioaddr Starting address of the I/O range.
size Size of the range.
Returns:
0 on success, EPERM if the caller lacks the CAP_IO_MANAGER capability, ENOENT if there is no task with specified ID and ENOMEM if there was some problem in allocating memory.

Definition at line 87 of file ddi.c.

int klog_printf ( const char *  fmt,
  ... 
)

Print formatted text to klog.

Parameters:
fmt Format string
See also:
For more details about format string see printf_core.

Definition at line 66 of file klog.c.

int klog_vprintf ( const char *  fmt,
va_list  ap 
)

Print formatted text to klog.

Parameters:
fmt Format string
ap Format parameters
See also:
For more details about format string see printf_core.

Definition at line 111 of file klog.c.

static void link_initialize ( link_t link  )  [inline, static]

Initialize doubly-linked circular list link.

Initialize doubly-linked list link.

Parameters:
link Pointer to link_t structure to be initialized.

Definition at line 71 of file list.h.

static void list_append ( link_t link,
link_t list 
) [inline, static]

Add item to the end of doubly-linked circular list.

Add item to the end of doubly-linked circular list.

Parameters:
link Pointer to link_t structure to be added.
list Pointer to link_t structure representing the list.

Definition at line 114 of file list.h.

void list_concat ( link_t head1,
link_t head2 
)

Concatenate two lists.

Concatenate lists head1 and head2, producing a single list head1 containing items from both (in head1, head2 order) and empty list head2.

Parameters:
head1 First list and concatenated output
head2 Second list and empty output.

Definition at line 76 of file list.c.

unsigned int list_count ( const link_t link  ) 

Count list items.

Return the number of items in the list.

Parameters:
link List to count.
Returns:
Number of items in the list.

Definition at line 98 of file list.c.

static int list_empty ( link_t list  )  [inline, static]

Query emptiness of doubly-linked circular list.

Query emptiness of doubly-linked circular list.

Parameters:
list Pointer to link_t structure representing the list.

Definition at line 160 of file list.h.

static link_t* list_head ( link_t list  )  [inline, static]

Get head item of a list.

Parameters:
list Pointer to link_t structure representing the list.
Returns:
Head item of the list.

NULL if the list is empty.

Definition at line 173 of file list.h.

static void list_initialize ( link_t list  )  [inline, static]

Initialize doubly-linked circular list.

Initialize doubly-linked circular list.

Parameters:
list Pointer to link_t structure representing the list.

Definition at line 84 of file list.h.

int list_member ( const link_t link,
const link_t head 
)

Check for membership.

Check whether link is contained in the list head. The membership is defined as pointer equivalence.

Parameters:
link Item to look for.
head List to look in.
Returns:
true if link is contained in head, false otherwise.

Definition at line 49 of file list.c.

static link_t* list_nth ( link_t list,
unsigned int  n 
) [inline, static]

Get n-th item of a list.

Parameters:
list Pointer to link_t structure representing the list.
n Item number (indexed from zero).
Returns:
n-th item of the list.

NULL if no n-th item found.

Definition at line 241 of file list.h.

static void list_prepend ( link_t link,
link_t list 
) [inline, static]

Add item to the beginning of doubly-linked circular list.

Add item to the beginning of doubly-linked circular list.

Parameters:
link Pointer to link_t structure to be added.
list Pointer to link_t structure representing the list.

Definition at line 98 of file list.h.

static void list_remove ( link_t link  )  [inline, static]

Remove item from doubly-linked circular list.

Remove item from doubly-linked circular list.

Parameters:
link Pointer to link_t structure to be removed from the list it is contained in.

Definition at line 146 of file list.h.

int listen ( int  socket_id,
int  backlog 
)

Sets the number of connections waiting to be accepted.

Parameters:
[in] socket_id Socket identifier.
[in] backlog The maximum number of waiting sockets to be accepted.
Returns:
EOK on success.

EINVAL if the backlog parameter is not positive (<=0).

ENOTSOCK if the socket is not found.

Other error codes as defined for the NET_SOCKET_LISTEN message.

Definition at line 582 of file socket_client.c.

void loader_abort ( loader_t ldr  ) 

Cancel the loader session.

Tells the loader not to load any program and terminate. After using this function, no further operations must be performed on the loader structure. It should be de-allocated using free().

Parameters:
ldr Loader connection structure.
Returns:
Zero on success or negative error code.

Definition at line 338 of file loader.c.

int loader_get_task_id ( loader_t ldr,
task_id_t task_id 
)

Get ID of the new task.

Retrieves the ID of the new task from the loader.

Parameters:
ldr Loader connection structure.
task_id Points to a variable where the ID should be stored.
Returns:
Zero on success or negative error code.

Definition at line 87 of file loader.c.

int loader_load_program ( loader_t ldr  ) 

Instruct loader to load the program.

If this function succeeds, the program has been successfully loaded and is ready to be executed.

Parameters:
ldr Loader connection structure.
Returns:
Zero on success or negative error code.

Definition at line 297 of file loader.c.

int loader_run ( loader_t ldr  ) 

Instruct loader to execute the program.

Note that this function blocks until the loader actually replies so you cannot expect this function to return if you are debugging the task and its thread is stopped.

After using this function, no further operations must be performed on the loader structure. It should be de-allocated using free().

Parameters:
ldr Loader connection structure.
Returns:
Zero on success or negative error code.

Definition at line 316 of file loader.c.

int loader_set_args ( loader_t ldr,
const char *const   argv[] 
)

Set command-line arguments for the program.

Sets the vector of command-line arguments to be passed to the loaded program. By convention, the very first argument is typically the same as the command used to execute the program.

Parameters:
ldr Loader connection structure.
argv NULL-terminated array of pointers to arguments.
Returns:
Zero on success or negative error code.

Definition at line 186 of file loader.c.

int loader_set_cwd ( loader_t ldr  ) 

Set current working directory for the loaded task.

Sets the current working directory for the loaded task.

Parameters:
ldr Loader connection structure.
Returns:
Zero on success or negative error code.

Definition at line 112 of file loader.c.

int loader_set_files ( loader_t ldr,
fdi_node_t *const   files[] 
)

Set preset files for the program.

Sets the vector of preset files to be passed to the loaded program. By convention, the first three files represent stdin, stdout and stderr respectively.

Parameters:
ldr Loader connection structure.
files NULL-terminated array of pointers to files.
Returns:
Zero on success or negative error code.

Definition at line 244 of file loader.c.

int loader_set_pathname ( loader_t ldr,
const char *  path 
)

Set pathname of the program to load.

Sets the name of the program file to load. The name can be relative to the current working directory (it will be absolutized before sending to the loader).

Parameters:
ldr Loader connection structure.
path Pathname of the program file.
Returns:
Zero on success or negative error code.

Definition at line 150 of file loader.c.

int loader_spawn ( const char *  name  ) 

Connect to a new program loader.

Spawns a new program loader task and returns the connection structure.

Parameters:
name Symbolic name to set on the newly created task.
Returns:
Pointer to the loader connection structure (should be deallocated using free() after use).

Definition at line 57 of file loader.c.

int log_init ( const char *  prog_name,
log_level_t  level 
)

Initialize the logging system.

Parameters:
prog_name Program name, will be printed as part of message
level Minimum message level to print

Definition at line 68 of file log.c.

void log_msg ( log_level_t  level,
const char *  fmt,
  ... 
)

Write an entry to the log.

Parameters:
level Message verbosity level. Message is only printed if verbosity is less than or equal to current reporting level.
fmt Format string (no traling newline).

Definition at line 88 of file log.c.

void log_msgv ( log_level_t  level,
const char *  fmt,
va_list  args 
)

Write an entry to the log (va_list variant).

Parameters:
level Message verbosity level. Message is only printed if verbosity is less than or equal to current reporting level.
fmt Format string (no trailing newline)

Definition at line 104 of file log.c.

int main ( int  argc,
char *  argv[] 
)

Main entry point.

Parameters:
[in] argc Nmber of arguments in argv vector (ignored).
[in] argv Cmdline argument vector (ignored).
Returns:
Error code.
Driver debug level is set here.

Definition at line 84 of file scli.c.

void * malloc ( const size_t  size  ) 

Allocate memory.

Parameters:
size Number of bytes to allocate.
Returns:
Allocated memory or NULL.

Definition at line 753 of file malloc.c.

static void* malloc_area ( heap_area_t area,
heap_block_head_t first_block,
heap_block_head_t final_block,
size_t  real_size,
size_t  falign 
) [static]

Allocate memory from heap area starting from given block.

Should be called only inside the critical section. As a side effect this function also sets the current pointer on successful allocation.

Parameters:
area Heap area where to allocate from.
first_block Starting heap block.
final_block Heap block where to finish the search (may be NULL).
real_size Gross number of bytes to allocate.
falign Physical alignment of the block.
Returns:
Address of the allocated block or NULL on not enough memory.

Definition at line 548 of file malloc.c.

static void* malloc_internal ( const size_t  size,
const size_t  align 
) [static]

Allocate a memory block.

Should be called only inside the critical section.

Parameters:
size The size of the block to allocate.
align Memory address alignment.
Returns:
Address of the allocated block or NULL on not enough memory.

Definition at line 678 of file malloc.c.

measured_string_t * measured_string_copy ( measured_string_t source  ) 

Copies the given measured string with separated header and data parts.

Parameters:
[in] source The source measured string to be copied.
Returns:
The copy of the given measured string.

NULL if the source parameter is NULL.

NULL if there is not enough memory left.

Definition at line 90 of file measured_strings.c.

measured_string_t * measured_string_create_bulk ( const uint8_t *  string,
size_t  length 
)

Creates a new measured string bundled with a copy of the given string itself as one memory block.

If the measured string is being freed, whole memory block is freed. The measured string should be used only as a constant.

Parameters:
[in] string The initial character string to be stored.
[in] length The length of the given string without the terminating zero ('') character. If the length is zero, the actual length is computed. The given length is used and appended with the terminating zero ('') character otherwise.
Returns:
The new bundled character string with measured length.

NULL if there is not enough memory left.

Definition at line 61 of file measured_strings.c.

int measured_strings_receive ( measured_string_t **  strings,
uint8_t **  data,
size_t  count 
)

Receives a measured strings array from a calling module.

Creates the array and the data memory blocks. This method should be used only while processing IPC messages as the array size has to be negotiated in advance.

Parameters:
[out] strings The received measured strings array.
[out] data The measured strings data. This memory block stores the actual character strings.
[in] count The size of the measured strings array.
Returns:
EOK on success.

EINVAL if the strings or data parameter is NULL.

EINVAL if the count parameter is zero (0).

EINVAL if the sent array differs in size.

EINVAL if there is inconsistency in sent measured strings' lengths (should not occur).

ENOMEM if there is not enough memory left.

Other error codes as defined for the async_data_write_finalize() function.

Definition at line 133 of file measured_strings.c.

int measured_strings_reply ( const measured_string_t strings,
size_t  count 
)

Replies the given measured strings array to a calling module.

This method should be used only while processing IPC messages as the array size has to be negotiated in advance.

Parameters:
[in] strings The measured strings array to be transferred.
[in] count The measured strings array size.
Returns:
EOK on success.

EINVAL if the strings parameter is NULL.

EINVAL if the count parameter is zero (0).

EINVAL if the calling module does not accept the given array size.

EINVAL if there is inconsistency in sent measured strings' lengths (should not occur).

Other error codes as defined for the async_data_read_finalize() function.

Definition at line 250 of file measured_strings.c.

int measured_strings_return ( int  phone,
measured_string_t **  strings,
uint8_t **  data,
size_t  count 
)

Receives a measured strings array from another module.

Creates the array and the data memory blocks. This method should be used only following other IPC messages as the array size has to be negotiated in advance.

Parameters:
[in] phone The other module phone.
[out] strings The returned measured strings array.
[out] data The measured strings data. This memory block stores the actual character strings.
[in] count The size of the measured strings array.
Returns:
EOK on success.

EINVAL if the strings or data parameter is NULL.

EINVAL if the phone or count parameter is not positive.

EINVAL if the sent array differs in size.

ENOMEM if there is not enough memory left.

Other error codes as defined for the async_data_read_start() function.

Definition at line 313 of file measured_strings.c.

int measured_strings_send ( int  phone,
const measured_string_t strings,
size_t  count 
)

Sends the given measured strings array to another module.

This method should be used only following other IPC messages as the array size has to be negotiated in advance.

Parameters:
[in] phone The other module phone.
[in] strings The measured strings array to be transferred.
[in] count The measured strings array size.
Returns:
EOK on success.

EINVAL if the strings parameter is NULL.

EINVAL if the phone or count parameter is not positive.

Other error codes as defined for the async_data_write_start() function.

Definition at line 387 of file measured_strings.c.

void * memalign ( const size_t  align,
const size_t  size 
)

Allocate memory with specified alignment.

Parameters:
align Alignment in byes.
size Number of bytes to allocate.
Returns:
Allocated memory or NULL.

Definition at line 770 of file malloc.c.

module_t* module_find ( const char *  name  ) 

Find module structure by soname/pathname.

Used primarily to see if a module has already been loaded. Modules are compared according to their soname, i.e. possible path components are ignored.

Definition at line 93 of file module.c.

module_t* module_load ( const char *  name  ) 

Load a module.

Currently this trivially tries to load '/<name>'.

Definition at line 130 of file module.c.

void module_process_relocs ( module_t m  ) 

(Eagerly) process all relocation tables in a module.

Currently works as if LD_BIND_NOW was specified.

Definition at line 55 of file module.c.

void modules_process_relocs ( module_t start  ) 

Process relocations in modules.

Processes relocations in start and all its dependencies. Modules that have already been relocated are unaffected.

Parameters:
start The module where to start from.

Definition at line 249 of file module.c.

static int notification_fibril ( void *  arg  )  [static]

Notification fibril.

When a notification arrives, a fibril with this implementing function is created. It calls interrupt_received() and does the final cleanup.

Parameters:
arg Message structure pointer.
Returns:
Always zero.

Definition at line 400 of file async.c.

static int packet_is_valid ( const packet_t packet  )  [inline, static]

Returns whether the packet is valid.

Parameters:
[in] packet The packet to be checked.
Returns:
True if the packet is not NULL and the magic value is correct.

False otherwise.

Definition at line 130 of file packet_header.h.

int physmem_map ( void *  pf,
void *  vp,
unsigned long  pages,
int  flags 
)

Map piece of physical memory to task.

Caller of this function must have the CAP_MEM_MANAGER capability.

Parameters:
pf Physical address of the starting frame.
vp Virtual address of the starting page.
pages Number of pages to map.
flags Flags for the new address space area.
Returns:
0 on success, EPERM if the caller lacks the CAP_MEM_MANAGER capability, ENOENT if there is no task with specified ID and ENOMEM if there was some problem in creating address space area.

Definition at line 68 of file ddi.c.

int pio_enable ( void *  pio_addr,
size_t  size,
void **  use_addr 
)

Enable PIO for specified I/O range.

Parameters:
pio_addr I/O start address.
size Size of the I/O region.
use_addr Address where the final address for application's PIO will be stored.
Returns:
Zero on success or negative error code.

Definition at line 107 of file ddi.c.

int pm_add ( packet_t packet  ) 

Adds the packet mapping.

Parameters:
[in] packet The packet to be remembered.
Returns:
EOK on success.

EINVAL if the packet is not valid.

EINVAL if the packet map is not initialized.

ENOMEM if there is not enough memory left.

Definition at line 137 of file packet.c.

packet_t * pm_find ( packet_id_t  packet_id  ) 

Finds the packet mapping.

Parameters:
[in] packet_id The packet identifier to be found.
Returns:
The found packet reference.

NULL if the mapping does not exist.

Definition at line 106 of file packet.c.

int pm_init ( void   ) 

Initializes the packet map.

Returns:
EOK on success.

ENOMEM if there is not enough memory left.

Definition at line 87 of file packet.c.

int pq_add ( packet_t **  first,
packet_t packet,
size_t  order,
size_t  metric 
)

Add packet to the sorted queue.

The queue is sorted in the ascending order. The packet is inserted right before the packets of the same order value.

Parameters:
[in,out] first The first packet of the queue. Sets the first packet of the queue. The original first packet may be shifted by the new packet.
[in] packet The packet to be added.
[in] order The packet order value.
[in] metric The metric value of the packet.
Returns:
EOK on success.

EINVAL if the first parameter is NULL.

EINVAL if the packet is not valid.

Definition at line 211 of file packet.c.

void pq_destroy ( packet_t first,
void(*)(packet_t *packet packet_release 
)

Releases the whole queue.

Detaches all packets of the queue and calls the packet_release() for each of them.

Parameters:
[in] first The first packet of the queue.
[in] packet_release The releasing function called for each of the packets after its detachment.

Definition at line 374 of file packet.c.

packet_t * pq_detach ( packet_t packet  ) 

Detach the packet from the queue.

Parameters:
[in] packet The packet to be detached.
Returns:
The next packet in the queue. If the packet is the first one of the queue, this becomes the new first one.

NULL if there is no packet left.

NULL if the packet is not valid.

Definition at line 305 of file packet.c.

packet_t * pq_find ( packet_t packet,
size_t  order 
)

Finds the packet with the given order.

Parameters:
[in] first The first packet of the queue.
[in] order The packet order value.
Returns:
The packet with the given order.

NULL if the first packet is not valid.

NULL if the packet is not found.

Definition at line 255 of file packet.c.

int pq_get_order ( packet_t packet,
size_t order,
size_t metric 
)

Sets the packet order and metric attributes.

Parameters:
[in] packet The packet to be set.
[out] order The packet order value.
[out] metric The metric value of the packet.
Returns:
EOK on success.

EINVAL if the packet is invalid.

Definition at line 351 of file packet.c.

int pq_insert_after ( packet_t packet,
packet_t new_packet 
)

Inserts packet after the given one.

Parameters:
[in] packet The packet in the queue.
[in] new_packet The new packet to be inserted.
Returns:
EOK on success.

EINVAL if etiher of the packets is invalid.

Definition at line 280 of file packet.c.

packet_t * pq_next ( packet_t packet  ) 

Returns the next packet in the queue.

Parameters:
[in] packet The packet queue member.
Returns:
The next packet in the queue.

NULL if there is no next packet.

NULL if the packet is not valid.

Definition at line 397 of file packet.c.

packet_t * pq_previous ( packet_t packet  ) 

Returns the previous packet in the queue.

Parameters:
[in] packet The packet queue member.
Returns:
The previous packet in the queue.

NULL if there is no previous packet.

NULL if the packet is not valid.

Definition at line 412 of file packet.c.

int pq_set_order ( packet_t packet,
size_t  order,
size_t  metric 
)

Sets the packet order and metric attributes.

Parameters:
[in] packeti The packet to be set.
[in] order The packet order value.
[in] metric The metric value of the packet.
Returns:
EOK on success.

EINVAL if the packet is invalid.

Definition at line 333 of file packet.c.

static size_t* prepare_lengths ( const measured_string_t strings,
size_t  count 
) [static]

Computes the lengths of the measured strings in the given array.

Parameters:
[in] strings The measured strings array to be processed.
[in] count The measured strings array size.
Returns:
The computed sizes array.

NULL if there is not enough memory left.

Definition at line 214 of file measured_strings.c.

int printf ( const char *  fmt,
  ... 
)

Print formatted text to stdout.

Parameters:
fmt Format string
See also:
For more details about format string see printf_core.

Definition at line 65 of file printf.c.

int printf_core ( const char *  fmt,
printf_spec_t ps,
va_list  ap 
)

Print formatted string.

Print string formatted according to the fmt parameter and variadic arguments. Each formatting directive must have the following form:

% [ FLAGS ] [ WIDTH ] [ .PRECISION ] [ TYPE ] CONVERSION

FLAGS:

WIDTH:

PRECISION:

TYPE:

CONVERSION:

All other characters from fmt except the formatting directives are printed verbatim.

Parameters:
fmt Format NULL-terminated string.
Returns:
Number of characters printed, negative value on failure.

Definition at line 599 of file printf_core.c.

static bool process_notification ( ipc_callid_t  callid,
ipc_call_t call 
) [static]

Process interrupt notification.

A new fibril is created which would process the notification.

Parameters:
callid Hash of the incoming call.
call Data of the incoming call.
Returns:
False if an error occured. True if the call was passed to the notification fibril.

Definition at line 420 of file async.c.

bool qsort ( void *  data,
size_t  cnt,
size_t  elem_size,
sort_cmp_t  cmp,
void *  arg 
)

Quicksort wrapper.

This is only a wrapper that takes care of memory allocations for storing the pivot and temporary elements for generic quicksort algorithm.

Parameters:
data Pointer to data to be sorted.
cnt Number of elements to be sorted.
elem_size Size of one element.
cmp Comparator function.
arg 3rd argument passed to cmp.
Returns:
True if sorting succeeded.

Definition at line 190 of file sort.c.

void * realloc ( const void *  addr,
const size_t  size 
)

Reallocate memory block.

Parameters:
addr Already allocated memory or NULL.
size New size of the memory block.
Returns:
Reallocated memory or NULL.

Definition at line 793 of file malloc.c.

ssize_t recv ( int  socket_id,
void *  data,
size_t  datalength,
int  flags 
)

Receives data via the socket.

Parameters:
[in] socket_id Socket identifier.
[out] data The data buffer to be filled.
[in] datalength The data length.
[in] flags Various receive flags.
Returns:
Positive received message size in bytes on success.

Zero if no more data (other side closed the connection).

ENOTSOCK if the socket is not found.

EBADMEM if the data parameter is NULL.

NO_DATA if the datalength parameter is zero.

Other error codes as defined for the NET_SOCKET_RECV message.

Definition at line 1115 of file socket_client.c.

ssize_t recvfrom ( int  socket_id,
void *  data,
size_t  datalength,
int  flags,
struct sockaddr fromaddr,
socklen_t addrlen 
)

Receives data via the socket.

Parameters:
[in] socket_id Socket identifier.
[out] data The data buffer to be filled.
[in] datalength The data length.
[in] flags Various receive flags.
[out] fromaddr The source address.
[in,out] addrlen The address length. The maximum address length is read. The actual address length is set.
Returns:
Positive received message size in bytes on success.

Zero if no more data (other side closed the connection).

ENOTSOCK if the socket is not found.

EBADMEM if the data or fromaddr parameter is NULL.

NO_DATA if the datalength or addrlen parameter is zero.

Other error codes as defined for the NET_SOCKET_RECVFROM message.

Definition at line 1140 of file socket_client.c.

static ssize_t recvfrom_core ( sysarg_t  message,
int  socket_id,
void *  data,
size_t  datalength,
int  flags,
struct sockaddr fromaddr,
socklen_t addrlen 
) [static]

Receives data via the socket.

Parameters:
[in] message The action message.
[in] socket_id Socket identifier.
[out] data The data buffer to be filled.
[in] datalength The data length.
[in] flags Various receive flags.
[out] fromaddr The source address. May be NULL for connected sockets.
[in,out] addrlen The address length. The maximum address length is read. The actual address length is set. Used only if fromaddr is not NULL.
Returns:
Positive received message size in bytes on success.

Zero if no more data (other side closed the connection).

ENOTSOCK if the socket is not found.

EBADMEM if the data parameter is NULL.

NO_DATA if the datalength or addrlen parameter is zero.

Other error codes as defined for the spcific message.

Definition at line 975 of file socket_client.c.

void refresh_answer ( ipc_call_t answer,
size_t count 
)

Refresh answer structure and argument count.

Erase all arguments.

Parameters:
[in,out] answer Message processing answer structure.
[in,out] count Number of answer arguments.

Definition at line 230 of file modules.c.

int register_irq ( int  inr,
int  devno,
int  method,
irq_code_t *  ucode 
)

Register IRQ notification.

Parameters:
inr IRQ number.
devno Device number of the device generating inr.
method Use this method for notifying me.
ucode Top-half pseudocode handler.
Returns:
Value returned by the kernel.

Definition at line 139 of file ddi.c.

static void reply_received ( void *  arg,
int  retval,
ipc_call_t data 
) [static]

Reply received callback.

This function is called whenever a reply for an asynchronous message sent out by the asynchronous framework is received.

Notify the fibril which is waiting for this message that it has arrived.

Parameters:
arg Pointer to the asynchronous message record.
retval Value returned in the answer.
data Call data of the answer.

Definition at line 901 of file async.c.

static bool route_call ( ipc_callid_t  callid,
ipc_call_t call 
) [static]

Try to route a call to an appropriate connection fibril.

If the proper connection fibril is found, a message with the call is added to its message queue. If the fibril was not active, it is activated and all timeouts are unregistered.

Parameters:
callid Hash of the incoming call.
call Data of the incoming call.
Returns:
False if the call doesn't match any connection.

True if the call was passed to the respective connection fibril.

Definition at line 346 of file async.c.

int send ( int  socket_id,
void *  data,
size_t  datalength,
int  flags 
)

Sends data via the socket.

Parameters:
[in] socket_id Socket identifier.
[in] data The data to be sent.
[in] datalength The data length.
[in] flags Various send flags.
Returns:
EOK on success.

ENOTSOCK if the socket is not found.

EBADMEM if the data parameter is NULL.

NO_DATA if the datalength parameter is zero.

Other error codes as defined for the NET_SOCKET_SEND message.

Definition at line 916 of file socket_client.c.

int sendto ( int  socket_id,
const void *  data,
size_t  datalength,
int  flags,
const struct sockaddr toaddr,
socklen_t  addrlen 
)

Sends data via the socket to the remote address.

Binds the socket to a free port if not already connected/bound.

Parameters:
[in] socket_id Socket identifier.
[in] data The data to be sent.
[in] datalength The data length.
[in] flags Various send flags.
[in] toaddr The destination address.
[in] addrlen The address length.
Returns:
EOK on success.

ENOTSOCK if the socket is not found.

EBADMEM if the data or toaddr parameter is NULL.

NO_DATA if the datalength or the addrlen parameter is zero.

Other error codes as defined for the NET_SOCKET_SENDTO message.

Definition at line 942 of file socket_client.c.

static int sendto_core ( sysarg_t  message,
int  socket_id,
const void *  data,
size_t  datalength,
int  flags,
const struct sockaddr toaddr,
socklen_t  addrlen 
) [static]

Sends data via the socket to the remote address.

Binds the socket to a free port if not already connected/bound.

Parameters:
[in] message The action message.
[in] socket_id Socket identifier.
[in] data The data to be sent.
[in] datalength The data length.
[in] flags Various send flags.
[in] toaddr The destination address. May be NULL for connected sockets.
[in] addrlen The address length. Used only if toaddr is not NULL.
Returns:
EOK on success.

ENOTSOCK if the socket is not found.

EBADMEM if the data or toaddr parameter is NULL.

NO_DATA if the datalength or the addrlen parameter is zero (0).

Other error codes as defined for the NET_SOCKET_SENDTO message.

Definition at line 816 of file socket_client.c.

int setsockopt ( int  socket_id,
int  level,
int  optname,
const void *  value,
size_t  optlen 
)

Sets socket option.

Parameters:
[in] socket_id Socket identifier.
[in] level The socket options level.
[in] optname The socket option to be set.
[in] value The value to be set.
[in] optlen The value length.
Returns:
EOK on success.

ENOTSOCK if the socket is not found.

EBADMEM if the value parameter is NULL.

NO_DATA if the optlen parameter is zero.

Other error codes as defined for the NET_SOCKET_SETSOCKOPT message.

Definition at line 1223 of file socket_client.c.

static void shift_dot ( token_t t,
token_t tfsl,
token_t tlcomp 
) [static]

Eat the extra '.

'.

Parameters:
t The current TK_DOT token.

Definition at line 159 of file canonify.c.

static void shift_dotdot ( token_t t,
token_t tfsl,
token_t tlcomp 
) [static]

Collapse the TK_COMP TK_SLASH TK_DOTDOT pattern.

Parameters:
t The current TK_DOTDOT token.
tlcomp The last TK_COMP token.

Definition at line 171 of file canonify.c.

static void shift_slash ( token_t t,
token_t tfsl,
token_t tlcomp 
) [static]

Eat the extra '/'.

Parameters:
t The current TK_SLASH token.

Definition at line 148 of file canonify.c.

int snprintf ( char *  str,
size_t  size,
const char *  fmt,
  ... 
)

Print formatted to the given buffer with limited size.

Parameters:
str Buffer
size Buffer size
fmt Format string
See also:
For more details about format string see printf_core.

Definition at line 48 of file snprintf.c.

int socket ( int  domain,
int  type,
int  protocol 
)

Creates a new socket.

Parameters:
[in] domain The socket protocol family.
[in] type Socket type.
[in] protocol Socket protocol.
Returns:
The socket identifier on success.

EPFNOTSUPPORT if the protocol family is not supported.

ESOCKNOTSUPPORT if the socket type is not supported.

EPROTONOSUPPORT if the protocol is not supported.

ENOMEM if there is not enough memory left.

ELIMIT if there was not a free socket identifier found this time.

Other error codes as defined for the NET_SOCKET message.

Other error codes as defined for the bind_service_timeout() function.

Definition at line 399 of file socket_client.c.

static void socket_connection ( ipc_callid_t  iid,
ipc_call_t icall 
) [static]

Default thread for new connections.

Parameters:
[in] iid The initial message identifier.
[in] icall The initial message call structure.

Definition at line 205 of file socket_client.c.

static void socket_destroy ( socket_t socket  )  [static]

Clears and destroys the socket.

Parameters:
[in] socket The socket to be destroyed.

Definition at line 741 of file socket_client.c.

static int socket_generate_new_id ( void   )  [static]

Tries to find a new free socket identifier.

Returns:
The new socket identifier.

ELIMIT if there is no socket identifier available.

Definition at line 326 of file socket_client.c.

static sockets_t* socket_get_sockets ( void   )  [static]

Returns the active sockets.

Returns:
The active sockets.

Definition at line 181 of file socket_client.c.

static int socket_get_tcp_phone ( void   )  [static]

Returns the TCP module phone.

Connects to the TCP module if necessary.

Returns:
The TCP module phone.

Other error codes as defined for the bind_service_timeout() function.

Definition at line 291 of file socket_client.c.

static int socket_get_udp_phone ( void   )  [static]

Returns the UDP module phone.

Connects to the UDP module if necessary.

Returns:
The UDP module phone.

Other error codes as defined for the bind_service_timeout() function.

Definition at line 310 of file socket_client.c.

static void socket_initialize ( socket_t socket,
int  socket_id,
int  phone,
services_t  service 
) [static]

Initializes a new socket specific data.

Parameters:
[in,out] socket The socket to be initialized.
[in] socket_id The new socket identifier.
[in] phone The parent module phone.
[in] service The parent module service.

Definition at line 368 of file socket_client.c.

static int socket_send_data ( int  socket_id,
sysarg_t  message,
sysarg_t  arg2,
const void *  data,
size_t  datalength 
) [static]

Sends message to the socket parent module with specified data.

Parameters:
[in] socket_id Socket identifier.
[in] message The action message.
[in] arg2 The second message parameter.
[in] data The data to be sent.
[in] datalength The data length.
Returns:
EOK on success.

ENOTSOCK if the socket is not found.

EBADMEM if the data parameter is NULL.

NO_DATA if the datalength parameter is zero (0).

Other error codes as defined for the spcific message.

Definition at line 517 of file socket_client.c.

static void split_mark ( heap_block_head_t cur,
const size_t  size 
) [static]

Split heap block and mark it as used.

Should be called only inside the critical section.

Parameters:
cur Heap block to split.
size Number of bytes to split and mark from the beginning of the block.

Definition at line 514 of file malloc.c.

stats_cpu_t * stats_get_cpus ( size_t count  ) 

Get CPUs statistics.

Parameters:
count Number of records returned.
Returns:
Array of stats_cpu_t structures. If non-NULL then it should be eventually freed by free().

Definition at line 67 of file stats.c.

stats_exc_t * stats_get_exception ( unsigned int  excn  ) 

Get single exception statistics.

Parameters:
excn Exception number we are interested in.
Returns:
Pointer to the stats_exc_t structure. If non-NULL then it should be eventually freed by free().

Definition at line 248 of file stats.c.

stats_exc_t * stats_get_exceptions ( size_t count  ) 

Get exception statistics.

Parameters:
count Number of records returned.
Returns:
Array of stats_exc_t structures. If non-NULL then it should be eventually freed by free().

Definition at line 222 of file stats.c.

load_t * stats_get_load ( size_t count  ) 

Get system load.

Parameters:
count Number of load records returned.
Returns:
Array of load records (load_t). If non-NULL then it should be eventually freed by free().

Definition at line 275 of file stats.c.

stats_physmem_t * stats_get_physmem ( void   ) 

Get physical memory statistics.

Returns:
Pointer to the stats_physmem_t structure. If non-NULL then it should be eventually freed by free().

Definition at line 92 of file stats.c.

stats_task_t * stats_get_task ( task_id_t  task_id  ) 

Get single task statistics.

Parameters:
task_id Task ID we are interested in.
Returns:
Pointer to the stats_task_t structure. If non-NULL then it should be eventually freed by free().

Definition at line 142 of file stats.c.

stats_task_t * stats_get_tasks ( size_t count  ) 

Get task statistics.

Parameters:
count Number of records returned.
Returns:
Array of stats_task_t structures. If non-NULL then it should be eventually freed by free().

Definition at line 116 of file stats.c.

stats_thread_t * stats_get_thread ( thread_id_t  thread_id  ) 

Get single thread statistics.

Parameters:
thread_id Thread ID we are interested in.
Returns:
Pointer to the stats_thread_t structure. If non-NULL then it should be eventually freed by free().

Definition at line 195 of file stats.c.

stats_thread_t * stats_get_threads ( size_t count  ) 

Get thread statistics.

Parameters:
count Number of records returned.
Returns:
Array of stats_thread_t structures. If non-NULL then it should be eventually freed by free().

Definition at line 169 of file stats.c.

sysarg_t stats_get_uptime ( void   ) 

Get system uptime.

Returns:
System uptime (in seconds).

Definition at line 297 of file stats.c.

void stats_print_load_fragment ( load_t  upper,
unsigned int  dec_length 
)

Print load fixed-point value.

Print the load record fixed-point value in decimal representation on stdout.

Parameters:
upper Load record.
dec_length Number of decimal digits to print.

Definition at line 315 of file stats.c.

void str_append ( char *  dest,
size_t  size,
const char *  src 
)

Append one string to another.

Append source string src to string in destination buffer dest. Size of the destination buffer is dest. If the size of the output buffer is at least one byte, the output string will always be well-formed, i.e. null-terminated and containing only complete characters.

Parameters:
dest Destination buffer.
count Size of the destination buffer.
src Source string.

Definition at line 537 of file str.c.

char * str_chr ( const char *  str,
wchar_t  ch 
)

Find first occurence of character in string.

Parameters:
str String to search.
ch Character to look for.
Returns:
Pointer to character in str or NULL if not found.

Definition at line 663 of file str.c.

int str_cmp ( const char *  s1,
const char *  s2 
)

Compare two NULL terminated strings.

Do a char-by-char comparison of two NULL-terminated strings. The strings are considered equal iff they consist of the same characters on the minimum of their lengths.

Parameters:
s1 First string to compare.
s2 Second string to compare.
Returns:
0 if the strings are equal, -1 if first is smaller, 1 if second smaller.

Definition at line 394 of file str.c.

void str_cpy ( char *  dest,
size_t  size,
const char *  src 
)

Copy string.

Copy source string src to destination buffer dest. No more than size bytes are written. If the size of the output buffer is at least one byte, the output string will always be well-formed, i.e. null-terminated and containing only complete characters.

Parameters:
dest Destination buffer.
count Size of the destination buffer (must be > 0).
src Source string.

Definition at line 477 of file str.c.

wchar_t str_decode ( const char *  str,
size_t offset,
size_t  size 
)

Decode a single character from a string.

Decode a single character from a string of size size. Decoding starts at offset and this offset is moved to the beginning of the next character. In case of decoding error, offset generally advances at least by one. However, offset is never moved beyond size.

Parameters:
str String (not necessarily NULL-terminated).
offset Byte offset in string where to start decoding.
size Size of the string (in bytes).
Returns:
Value of decoded character, U_SPECIAL on decoding error or NULL if attempt to decode beyond size.

Definition at line 74 of file str.c.

char * str_dup ( const char *  src  ) 

Duplicate string.

Allocate a new string and copy characters from the source string into it. The duplicate string is allocated via sleeping malloc(), thus this function can sleep in no memory conditions.

The allocation cannot fail and the return value is always a valid pointer. The duplicate string is always a well-formed null-terminated UTF-8 string, but it can differ from the source string on the byte level.

Parameters:
src Source string.
Returns:
Duplicate string.

Definition at line 908 of file str.c.

const char * str_l18_win_locale ( l18_win_locales_t  locale  ) 

Get string representation of a given locale.

Parameters:
locale The locale.
Returns:
Name of the locale.

Definition at line 49 of file langs.c.

int str_lcmp ( const char *  s1,
const char *  s2,
size_t  max_len 
)

Compare two NULL terminated strings with length limit.

Do a char-by-char comparison of two NULL-terminated strings. The strings are considered equal iff they consist of the same characters on the minimum of their lengths and the length limit.

Parameters:
s1 First string to compare.
s2 Second string to compare.
max_len Maximum number of characters to consider.
Returns:
0 if the strings are equal, -1 if first is smaller, 1 if second smaller.

Definition at line 433 of file str.c.

size_t str_length ( const char *  str  ) 

Get number of characters in a string.

Parameters:
str NULL-terminated string.
Returns:
Number of characters in string.

Definition at line 286 of file str.c.

size_t str_lsize ( const char *  str,
size_t  max_len 
)

Get size of string with length limit.

Get the number of bytes which are used by up to max_len first characters in the string str. If max_len is greater than the length of str, the entire string is measured (excluding the NULL-terminator).

Parameters:
str String to consider.
max_len Maximum number of characters to measure.
Returns:
Number of bytes used by the characters.

Definition at line 246 of file str.c.

void str_ncpy ( char *  dest,
size_t  size,
const char *  src,
size_t  n 
)

Copy size-limited substring.

Copy prefix of string src of max. size size to destination buffer dest. No more than size bytes are written. The output string will always be well-formed, i.e. null-terminated and containing only complete characters.

No more than n bytes are read from the input string, so it does not have to be null-terminated.

Parameters:
dest Destination buffer.
count Size of the destination buffer (must be > 0).
src Source string.
n Maximum number of bytes to read from src.

Definition at line 509 of file str.c.

char * str_ndup ( const char *  src,
size_t  n 
)

Duplicate string with size limit.

Allocate a new string and copy up to bytes from the source string into it. The duplicate string is allocated via sleeping malloc(), thus this function can sleep in no memory conditions. No more than + 1 bytes is allocated, but if the size occupied by the source string is smaller than + 1, less is allocated.

The allocation cannot fail and the return value is always a valid pointer. The duplicate string is always a well-formed null-terminated UTF-8 string, but it can differ from the source string on the byte level.

Parameters:
src Source string.
n Maximum number of bytes to duplicate.
Returns:
Duplicate string.

Definition at line 939 of file str.c.

size_t str_nlength ( const char *  str,
size_t  size 
)

Get number of characters in a string with size limit.

Parameters:
str NULL-terminated string.
size Maximum number of bytes to consider.
Returns:
Number of characters in string.

Definition at line 322 of file str.c.

char * str_rchr ( const char *  str,
wchar_t  ch 
)

Find last occurence of character in string.

Parameters:
str String to search.
ch Character to look for.
Returns:
Pointer to character in str or NULL if not found.

Definition at line 685 of file str.c.

size_t str_size ( const char *  str  ) 

Get size of string.

Get the number of bytes which are used by the string str (excluding the NULL-terminator).

Parameters:
str String to consider.
Returns:
Number of bytes used by the string

Definition at line 208 of file str.c.

int str_size_t ( const char *  nptr,
char **  endptr,
unsigned int  base,
bool  strict,
size_t result 
)

Convert string to size_t.

Parameters:
nptr Pointer to string.
endptr If not NULL, pointer to the first invalid character is stored here.
base Zero or number between 2 and 36 inclusive.
strict Do not allow any trailing characters.
result Result of the conversion.
Returns:
EOK if conversion was successful.

Definition at line 1180 of file str.c.

void str_to_wstr ( wchar_t *  dest,
size_t  dlen,
const char *  src 
)

Convert string to wide string.

Convert string src to wide string. The output is written to the buffer specified by dest and dlen. dlen must be non-zero and the wide string written will always be null-terminated.

Parameters:
dest Destination buffer.
dlen Length of destination buffer (number of wchars).
src Source string.

Definition at line 634 of file str.c.

static int str_uint ( const char *  nptr,
char **  endptr,
unsigned int  base,
bool neg,
uint64_t *  result 
) [static]

Convert string to uint64_t (internal variant).

Parameters:
nptr Pointer to string.
endptr Pointer to the first invalid character is stored here.
base Zero or number between 2 and 36 inclusive.
neg Indication of unary minus is stored here. result Result of the conversion.
Returns:
EOK if conversion was successful.

Definition at line 1020 of file str.c.

int str_uint64 ( const char *  nptr,
char **  endptr,
unsigned int  base,
bool  strict,
uint64_t *  result 
)

Convert string to uint64_t.

Parameters:
nptr Pointer to string.
endptr If not NULL, pointer to the first invalid character is stored here.
base Zero or number between 2 and 36 inclusive.
strict Do not allow any trailing characters.
result Result of the conversion.
Returns:
EOK if conversion was successful.

Definition at line 1141 of file str.c.

long int strtol ( const char *  nptr,
char **  endptr,
int  base 
)

Convert initial part of string to long int according to given base.

The number may begin with an arbitrary number of whitespaces followed by optional sign (`+' or `-'). If the base is 0 or 16, the prefix `0x' may be inserted and the number will be taken as hexadecimal one. If the base is 0 and the number begin with a zero, number will be taken as octal one (as with base 8). Otherwise the base 0 is taken as decimal.

Parameters:
nptr Pointer to string.
endptr If not NULL, function stores here pointer to the first invalid character.
base Zero or number between 2 and 36 inclusive.
Returns:
Result of conversion.

Definition at line 873 of file str.c.

unsigned long strtoul ( const char *  nptr,
char **  endptr,
int  base 
)

Convert initial part of string to unsigned long according to given base.

The number may begin with an arbitrary number of whitespaces followed by optional sign (`+' or `-'). If the base is 0 or 16, the prefix `0x' may be inserted and the number will be taken as hexadecimal one. If the base is 0 and the number begin with a zero, number will be taken as octal one (as with base 8). Otherwise the base 0 is taken as decimal.

Parameters:
nptr Pointer to string.
endptr If not NULL, function stores here pointer to the first invalid character
base Zero or number between 2 and 36 inclusive.
Returns:
Result of conversion.

Definition at line 967 of file str.c.

elf_symbol_t* symbol_bfs_find ( const char *  name,
module_t start,
module_t **  mod 
)

Find the definition of a symbol in a module and its deps.

Search the module dependency graph is breadth-first, beginning from the module start. Thus, and all its dependencies get searched.

Parameters:
name Name of the symbol to search for.
start Module in which to start the search..
mod (output) Will be filled with a pointer to the module that contains the symbol.

Definition at line 116 of file symbol.c.

elf_symbol_t* symbol_def_find ( const char *  name,
module_t origin,
module_t **  mod 
)

Find the definition of a symbol.

By definition in System V ABI, if module origin has the flag DT_SYMBOLIC, origin is searched first. Otherwise, or if the symbol hasn't been found, the module dependency graph is searched breadth-first, beginning from the executable program.

Parameters:
name Name of the symbol to search for.
origin Module in which the dependency originates.
mod (output) Will be filled with a pointer to the module that contains the symbol.

Definition at line 193 of file symbol.c.

void * sysinfo_get_data ( const char *  path,
size_t size 
)

Get sysinfo binary data.

Parameters:
path Sysinfo path.
value Pointer to store the binary data size.
Returns:
Binary data read from sysinfo or NULL if the sysinfo item value type is not binary data. The returned non-NULL pointer should be freed by free().

Definition at line 96 of file sysinfo.c.

static int sysinfo_get_data_size ( const char *  path,
size_t size 
) [static]

Get sysinfo binary data size.

Parameters:
path Sysinfo path.
value Pointer to store the binary data size.
Returns:
EOK if the value was successfully read and is of SYSINFO_VAL_DATA type.

Definition at line 79 of file sysinfo.c.

sysinfo_item_tag_t sysinfo_get_tag ( const char *  path  ) 

Get sysinfo item type.

Parameters:
path Sysinfo path.
Returns:
Sysinfo item type.

Definition at line 49 of file sysinfo.c.

int sysinfo_get_value ( const char *  path,
sysarg_t value 
)

Get sysinfo numerical value.

Parameters:
path Sysinfo path.
value Pointer to store the numerical value to.
Returns:
EOK if the value was successfully read and is of SYSINFO_VAL_VAL type.

Definition at line 64 of file sysinfo.c.

int task_kill ( task_id_t  task_id  ) 

Kill a task.

Parameters:
task_id ID of task to kill.
Returns:
Zero on success or negative error code.

Definition at line 80 of file task.c.

int task_set_name ( const char *  name  ) 

Set the task name.

Parameters:
name The new name, typically the command used to execute the program.
Returns:
Zero on success or negative error code.

Definition at line 68 of file task.c.

int task_spawnl ( task_id_t task_id,
const char *  path,
  ... 
)

Create a new task by running an executable from the filesystem.

This is really just a convenience wrapper over the more complicated loader API. Arguments are passed as a null-terminated list of arguments.

Parameters:
id If not NULL, the ID of the task is stored here on success.
path Pathname of the binary to execute.
... Command-line arguments.
Returns:
Zero on success or negative error code.

Definition at line 190 of file task.c.

int task_spawnv ( task_id_t id,
const char *  path,
const char *const   args[] 
)

Create a new task by running an executable from the filesystem.

This is really just a convenience wrapper over the more complicated loader API. Arguments are passed as a null-terminated array of strings.

Parameters:
id If not NULL, the ID of the task is stored here on success.
path Pathname of the binary to execute.
argv Command-line arguments.
Returns:
Zero on success or negative error code.

Definition at line 96 of file task.c.

int thread_create ( void(*)(void *)  function,
void *  arg,
const char *  name,
thread_id_t tid 
)

Create userspace thread.

This function creates new userspace thread and allocates userspace stack and userspace argument structure for it.

Parameters:
function Function implementing the thread.
arg Argument to be passed to thread.
name Symbolic name of the thread.
tid Thread ID of the newly created thread.
Returns:
Zero on success or a code from errno.h on failure.

Definition at line 91 of file thread.c.

void thread_detach ( thread_id_t  thread  ) 

Detach thread.

Currently not implemented.

Parameters:
thread TID.

Definition at line 148 of file thread.c.

void thread_exit ( int  status  ) 

Terminate current thread.

Parameters:
status Exit status. Currently not used.

Definition at line 134 of file thread.c.

thread_id_t thread_get_id ( void   ) 

Get current thread ID.

Returns:
Current thread ID.

Definition at line 169 of file thread.c.

int thread_join ( thread_id_t  thread  ) 

Join thread.

Currently not implemented.

Parameters:
thread TID.
Returns:
Thread exit status.

Definition at line 160 of file thread.c.

void tv_add ( struct timeval tv,
suseconds_t  usecs 
)

Add microseconds to given timeval.

Parameters:
tv Destination timeval.
usecs Number of microseconds to add.

Definition at line 59 of file time.c.

int tv_gt ( struct timeval tv1,
struct timeval tv2 
)

Decide if one timeval is greater than the other.

Parameters:
t1 First timeval.
t2 Second timeval.
Returns:
True if tv1 is greater than tv2.

False otherwise.

Definition at line 94 of file time.c.

int tv_gteq ( struct timeval tv1,
struct timeval tv2 
)

Decide if one timeval is greater than or equal to the other.

Parameters:
tv1 First timeval.
tv2 Second timeval.
Returns:
True if tv1 is greater than or equal to tv2.

False otherwise.

Definition at line 114 of file time.c.

suseconds_t tv_sub ( struct timeval tv1,
struct timeval tv2 
)

Subtract two timevals.

Parameters:
tv1 First timeval.
tv2 Second timeval.
Returns:
Difference between tv1 and tv2 (tv1 - tv2) in microseconds.

Definition at line 79 of file time.c.

int unregister_irq ( int  inr,
int  devno 
)

Unregister IRQ notification.

Parameters:
inr IRQ number.
devno Device number of the device generating inr.
Returns:
Value returned by the kernel.

Definition at line 153 of file ddi.c.

int int vfprintf ( FILE stream,
const char *  fmt,
va_list  ap 
)

Print formatted text.

Parameters:
stream Output stream
fmt Format string
ap Format parameters
See also:
For more details about format string see printf_core.

Definition at line 76 of file vprintf.c.

static int vfs_exchange_begin ( void   )  [static]

Start an async exchange on the VFS session.

Returns:
New phone to be used during the exchange.

Definition at line 133 of file vfs.c.

static void vfs_exchange_end ( int  phone  )  [static]

End an async exchange on the VFS session.

Parameters:
phone Phone used during the exchange.

Definition at line 147 of file vfs.c.

int int vprintf ( const char *  fmt,
va_list  ap 
)

Print formatted text to stdout.

Parameters:
fmt Format string
ap Format parameters
See also:
For more details about format string see printf_core.

Definition at line 104 of file vprintf.c.

static int vsnprintf_str_write ( const char *  str,
size_t  size,
vsnprintf_data_t data 
) [static]

Write string to given buffer.

Write at most data->size plain characters including trailing zero. According to C99, snprintf() has to return number of characters that would have been written if enough space had been available. Hence the return value is not the number of actually printed characters but size of the input string.

Parameters:
str Source string to print.
size Number of plain characters in str.
data Structure describing destination string, counter of used space and total string size.
Returns:
Number of characters to print (not characters actually printed).

Definition at line 64 of file vsnprintf.c.

static int vsnprintf_wstr_write ( const wchar_t *  str,
size_t  size,
vsnprintf_data_t data 
) [static]

Write wide string to given buffer.

Write at most data->size plain characters including trailing zero. According to C99, snprintf() has to return number of characters that would have been written if enough space had been available. Hence the return value is not the number of actually printed characters but size of the input string.

Parameters:
str Source wide string to print.
size Number of bytes in str.
data Structure describing destination string, counter of used space and total string size.
Returns:
Number of wide characters to print (not characters actually printed).

Definition at line 131 of file vsnprintf.c.

size_t wstr_length ( const wchar_t *  wstr  ) 

Get number of characters in a wide string.

Parameters:
str NULL-terminated wide string.
Returns:
Number of characters in str.

Definition at line 304 of file str.c.

bool wstr_linsert ( wchar_t *  str,
wchar_t  ch,
size_t  pos,
size_t  max_pos 
)

Insert a wide character into a wide string.

Insert a wide character into a wide string at position pos. The characters after the position are shifted.

Parameters:
str String to insert to.
ch Character to insert to.
pos Character index where to insert. @param max_pos Characters in the buffer.
Returns:
True if the insertion was sucessful, false if the position is out of bounds.

Definition at line 715 of file str.c.

size_t wstr_lsize ( const wchar_t *  str,
size_t  max_len 
)

Get size of wide string with length limit.

Get the number of bytes which are used by up to max_len first wide characters in the wide string str. If max_len is greater than the length of str, the entire wide string is measured (excluding the NULL-terminator).

Parameters:
str Wide string to consider.
max_len Maximum number of wide characters to measure.
Returns:
Number of bytes used by the wide characters.

Definition at line 274 of file str.c.

size_t wstr_nlength ( const wchar_t *  str,
size_t  size 
)

Get number of characters in a string with size limit.

Parameters:
str NULL-terminated string.
size Maximum number of bytes to consider.
Returns:
Number of characters in string.

Definition at line 341 of file str.c.

bool wstr_remove ( wchar_t *  str,
size_t  pos 
)

Remove a wide character from a wide string.

Remove a wide character from a wide string at position pos. The characters after the position are shifted.

Parameters:
str String to remove from.
pos Character index to remove.
Returns:
True if the removal was sucessful, false if the position is out of bounds.

Definition at line 743 of file str.c.

size_t wstr_size ( const wchar_t *  str  ) 

Get size of wide string.

Get the number of bytes which are used by the wide string str (excluding the NULL-terminator).

Parameters:
str Wide string to consider.
Returns:
Number of bytes used by the wide string

Definition at line 228 of file str.c.

char * wstr_to_astr ( const wchar_t *  src  ) 

Convert wide string to new string.

Convert wide string src to string. Space for the new string is allocated on the heap.

Parameters:
src Source wide string.
Returns:
New string.

Definition at line 583 of file str.c.

void wstr_to_str ( char *  dest,
size_t  size,
const wchar_t *  src 
)

Convert wide string to string.

Convert wide string src to string. The output is written to the buffer specified by dest and size. size must be non-zero and the string written will always be well-formed.

Parameters:
dest Destination buffer.
size Size of the destination buffer.
src Source wide string.

Definition at line 555 of file str.c.


Variable Documentation

pcb_t* __pcb

A pointer to the program control block.

Having received the PCB pointer, the C library startup code stores it here for later use.

Definition at line 37 of file pcb.c.

fibril_local int serialization_count [static]

Fibril-local count of serialization.

If > 0, we must not preempt

Definition at line 73 of file fibril.c.

int serialized_threads [static]

Number of threads that are executing a manager fibril and are serialized.

Protected by async_futex.

Definition at line 70 of file fibril.c.


Generated on Thu Jun 2 07:45:57 2011 for HelenOS/USB by  doxygen 1.4.7