libubox
C utility functions for OpenWrt.
|
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/socket.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#include <poll.h>
#include <time.h>
#include "udebug-priv.h"
#include "usock.h"
Go to the source code of this file.
Macros | |
#define | _GNU_SOURCE |
#define | ALIGN(i, sz) (((i) + (sz) - 1) & ~((sz) - 1)) |
#define | MAP_ANONYMOUS MAP_ANON |
#define | UDEBUG_MIN_ALLOC_LEN 128 |
Functions | |
static void | __randname (char *template) |
int | udebug_id_cmp (const void *k1, const void *k2, void *ptr) |
static int | shm_open_anon (char *name) |
static void | __udebug_disconnect (struct udebug *ctx, bool reconnect) |
uint64_t | udebug_timestamp (void) |
static int | __udebug_buf_map (struct udebug_buf *buf, int fd) |
static int | writev_retry (int fd, struct iovec *iov, int iov_len, int sock_fd) |
static int | recv_retry (int fd, struct iovec *iov, bool wait, int *recv_fd) |
static void | udebug_send_msg (struct udebug *ctx, struct udebug_client_msg *msg, struct blob_attr *meta, int fd) |
static bool | udebug_recv_msg (struct udebug *ctx, struct udebug_client_msg *msg, int *fd, bool wait) |
static struct udebug_client_msg * | __udebug_poll (struct udebug *ctx, int *fd, bool wait) |
static struct udebug_client_msg * | udebug_wait_for_response (struct udebug *ctx, struct udebug_client_msg *msg, int *rfd) |
static void | udebug_buf_msg (struct udebug_buf *buf, enum udebug_client_msg_type type) |
static size_t | __udebug_headsize (unsigned int ring_size) |
static void | udebug_init_page_size (void) |
int | udebug_buf_open (struct udebug_buf *buf, int fd, uint32_t ring_size, uint32_t data_size) |
int | udebug_buf_init (struct udebug_buf *buf, size_t entries, size_t size) |
static void * | udebug_buf_alloc (struct udebug_buf *buf, uint32_t ofs, uint32_t len) |
uint64_t | udebug_buf_flags (struct udebug_buf *buf) |
void | udebug_entry_init_ts (struct udebug_buf *buf, uint64_t timestamp) |
void * | udebug_entry_append (struct udebug_buf *buf, const void *data, uint32_t len) |
uint16_t | udebug_entry_trim (struct udebug_buf *buf, uint16_t len) |
void | udebug_entry_set_length (struct udebug_buf *buf, uint16_t len) |
int | udebug_entry_printf (struct udebug_buf *buf, const char *fmt,...) |
int | udebug_entry_vprintf (struct udebug_buf *buf, const char *fmt, va_list ap) |
void | udebug_entry_add (struct udebug_buf *buf) |
void | udebug_buf_free (struct udebug_buf *buf) |
static void | __udebug_buf_add (struct udebug *ctx, struct udebug_buf *buf) |
int | udebug_buf_add (struct udebug *ctx, struct udebug_buf *buf, const struct udebug_buf_meta *meta) |
void | udebug_init (struct udebug *ctx) |
static void | udebug_reconnect_cb (struct uloop_timeout *t) |
void | udebug_auto_connect (struct udebug *ctx, const char *path) |
int | udebug_connect (struct udebug *ctx, const char *path) |
void | udebug_poll (struct udebug *ctx) |
struct udebug_client_msg * | udebug_send_and_wait (struct udebug *ctx, struct udebug_client_msg *msg, int *rfd) |
static void | udebug_fd_cb (struct uloop_fd *fd, unsigned int events) |
void | udebug_add_uloop (struct udebug *ctx) |
void | udebug_free (struct udebug *ctx) |
Variables | |
static struct blob_buf | b |
static unsigned int | page_size |
|
static |
|
static |
Definition at line 697 of file udebug.c.
|
static |
|
static |
Definition at line 91 of file udebug.c.
|
static |
Definition at line 406 of file udebug.c.
|
static |
Definition at line 339 of file udebug.c.
|
static |
|
inlinestatic |
void udebug_add_uloop | ( | struct udebug * | ctx | ) |
Definition at line 827 of file udebug.c.
void udebug_auto_connect | ( | struct udebug * | ctx, |
const char * | path | ||
) |
int udebug_buf_add | ( | struct udebug * | ctx, |
struct udebug_buf * | buf, | ||
const struct udebug_buf_meta * | meta | ||
) |
Definition at line 724 of file udebug.c.
|
static |
Definition at line 504 of file udebug.c.
uint64_t udebug_buf_flags | ( | struct udebug_buf * | buf | ) |
void udebug_buf_free | ( | struct udebug_buf * | buf | ) |
Definition at line 681 of file udebug.c.
int udebug_buf_init | ( | struct udebug_buf * | buf, |
size_t | entries, | ||
size_t | size | ||
) |
|
static |
int udebug_buf_open | ( | struct udebug_buf * | buf, |
int | fd, | ||
uint32_t | ring_size, | ||
uint32_t | data_size | ||
) |
int udebug_connect | ( | struct udebug * | ctx, |
const char * | path | ||
) |
Definition at line 774 of file udebug.c.
void udebug_entry_add | ( | struct udebug_buf * | buf | ) |
Definition at line 642 of file udebug.c.
void* udebug_entry_append | ( | struct udebug_buf * | buf, |
const void * | data, | ||
uint32_t | len | ||
) |
Definition at line 545 of file udebug.c.
void udebug_entry_init_ts | ( | struct udebug_buf * | buf, |
uint64_t | timestamp | ||
) |
int udebug_entry_printf | ( | struct udebug_buf * | buf, |
const char * | fmt, | ||
... | |||
) |
Definition at line 595 of file udebug.c.
void udebug_entry_set_length | ( | struct udebug_buf * | buf, |
uint16_t | len | ||
) |
uint16_t udebug_entry_trim | ( | struct udebug_buf * | buf, |
uint16_t | len | ||
) |
int udebug_entry_vprintf | ( | struct udebug_buf * | buf, |
const char * | fmt, | ||
va_list | ap | ||
) |
|
static |
Definition at line 817 of file udebug.c.
void udebug_free | ( | struct udebug * | ctx | ) |
Definition at line 836 of file udebug.c.
int udebug_id_cmp | ( | const void * | k1, |
const void * | k2, | ||
void * | ptr | ||
) |
void udebug_init | ( | struct udebug * | ctx | ) |
|
static |
void udebug_poll | ( | struct udebug * | ctx | ) |
Definition at line 804 of file udebug.c.
|
static |
|
static |
Definition at line 322 of file udebug.c.
struct udebug_client_msg* udebug_send_and_wait | ( | struct udebug * | ctx, |
struct udebug_client_msg * | msg, | ||
int * | rfd | ||
) |
|
static |
Definition at line 303 of file udebug.c.
uint64_t udebug_timestamp | ( | void | ) |
|
static |
|
static |