mirror of
https://github.com/linux-msm/qrtr.git
synced 2026-02-25 13:11:26 -08:00
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@@ -52,20 +52,17 @@ jobs:
|
||||
#- ubuntu:xenial
|
||||
cross_compile: [""]
|
||||
variant: [""]
|
||||
nosystemd: [""]
|
||||
include:
|
||||
# Alpine (OpenRC)
|
||||
- container: "alpine:edge"
|
||||
arch: x86-64
|
||||
family: x86-64
|
||||
compiler: gcc
|
||||
nosystemd: true
|
||||
|
||||
- container: "alpine:latest"
|
||||
arch: x86-64
|
||||
family: x86-64
|
||||
compiler: gcc
|
||||
nosystemd: true
|
||||
|
||||
# Debian 32-bit builds
|
||||
- container: "debian:testing"
|
||||
@@ -218,7 +215,6 @@ jobs:
|
||||
- name: Meson init with cross compile
|
||||
if: ${{ matrix.variant == 'cross-compile' }}
|
||||
run: |
|
||||
# installing systemd (for pkg-config) has personality issues with cross-compilation
|
||||
# Generate cross compile file (see https://mesonbuild.com/Cross-compilation.html#cross-compilation)
|
||||
echo "[binaries]" > cross.txt
|
||||
echo "c = '${CROSS_COMPILE}-gcc'" >> cross.txt
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,4 +2,3 @@ out/
|
||||
*.so
|
||||
qrtr-cfg
|
||||
qrtr-lookup
|
||||
qrtr-ns
|
||||
|
||||
17
Android.bp
17
Android.bp
@@ -11,22 +11,6 @@ cc_library {
|
||||
local_include_dirs: ["src"],
|
||||
}
|
||||
|
||||
cc_binary {
|
||||
name: "qrtr-ns",
|
||||
vendor: true,
|
||||
srcs: [
|
||||
"lib/logging.c",
|
||||
"src/addr.c",
|
||||
"src/ns.c",
|
||||
"src/map.c",
|
||||
"src/hash.c",
|
||||
"src/waiter.c",
|
||||
"src/util.c",
|
||||
],
|
||||
cflags: ["-Wno-error"],
|
||||
local_include_dirs: ["lib"],
|
||||
}
|
||||
|
||||
cc_binary {
|
||||
name: "qrtr-cfg",
|
||||
vendor: true,
|
||||
@@ -45,7 +29,6 @@ cc_binary {
|
||||
srcs: [
|
||||
"lib/logging.c",
|
||||
"src/lookup.c",
|
||||
"src/util.c",
|
||||
],
|
||||
cflags: ["-Wno-error"],
|
||||
local_include_dirs: ["lib"],
|
||||
|
||||
@@ -17,7 +17,6 @@ case $CC in
|
||||
esac
|
||||
|
||||
pacman -Syu --noconfirm \
|
||||
systemd-libs \
|
||||
pkgconf \
|
||||
meson \
|
||||
$PKGS_CC
|
||||
|
||||
@@ -22,7 +22,4 @@ apt install -y --no-install-recommends \
|
||||
libc6-dev:${ARCH} \
|
||||
gcc-`dpkg-architecture -a ${ARCH} -q DEB_TARGET_GNU_TYPE`
|
||||
|
||||
# Thanks debian
|
||||
apt install -y --no-install-recommends systemd-dev:${ARCH} -a ${ARCH} || true
|
||||
|
||||
echo "Install finished: $0"
|
||||
|
||||
@@ -30,11 +30,7 @@ esac
|
||||
apt install -y --no-install-recommends \
|
||||
pkg-config \
|
||||
meson \
|
||||
systemd \
|
||||
libc6-dev \
|
||||
$PKGS_CC
|
||||
|
||||
# Thanks debian
|
||||
apt install -y --no-install-recommends systemd-dev || true
|
||||
|
||||
echo "Install finished: $0"
|
||||
|
||||
@@ -20,8 +20,6 @@ dnf -y install \
|
||||
meson \
|
||||
pkg-config \
|
||||
libudev-devel \
|
||||
systemd-devel \
|
||||
systemd-libs \
|
||||
$PKGS_CC
|
||||
|
||||
echo "Install finished: $0"
|
||||
|
||||
25
meson.build
25
meson.build
@@ -10,33 +10,8 @@ project('qrtr',
|
||||
])
|
||||
|
||||
prefix = get_option('prefix')
|
||||
with_qrtr_ns = get_option('qrtr-ns')
|
||||
|
||||
install_systemd_unit = get_option('systemd-service')
|
||||
systemd = dependency('systemd', required : install_systemd_unit)
|
||||
if systemd.found()
|
||||
systemd_system_unit_dir = get_option('systemd-unit-prefix')
|
||||
if systemd_system_unit_dir == ''
|
||||
systemd_system_unit_dir = systemd.get_variable(
|
||||
pkgconfig : 'systemdsystemunitdir',
|
||||
pkgconfig_define: ['prefix', prefix])
|
||||
else
|
||||
message('Could not resolve systemd dependencies, skipping unit file')
|
||||
install_systemd_unit = false
|
||||
endif
|
||||
endif
|
||||
|
||||
inc = include_directories('include')
|
||||
subdir('lib')
|
||||
subdir('include')
|
||||
subdir('src')
|
||||
|
||||
if systemd.found() and with_qrtr_ns.enabled()
|
||||
systemd_unit_conf = configuration_data()
|
||||
systemd_unit_conf.set('prefix', prefix)
|
||||
configure_file(
|
||||
input : 'qrtr-ns.service.in',
|
||||
output : 'qrtr-ns.service',
|
||||
configuration : systemd_unit_conf,
|
||||
install_dir : systemd_system_unit_dir)
|
||||
endif
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
option('qrtr-ns',
|
||||
type: 'feature',
|
||||
value: 'auto',
|
||||
description: 'Whether or not to build the qrtr-ns binary'
|
||||
)
|
||||
|
||||
option('systemd-unit-prefix',
|
||||
type: 'string',
|
||||
description: 'Directory for systemd system unit files'
|
||||
)
|
||||
|
||||
option('systemd-service',
|
||||
type: 'feature',
|
||||
value: 'auto',
|
||||
description: 'Whether or not the systemd service should be built'
|
||||
)
|
||||
@@ -1,9 +0,0 @@
|
||||
[Unit]
|
||||
Description=QIPCRTR Name Service
|
||||
|
||||
[Service]
|
||||
ExecStart=@prefix@/bin/qrtr-ns -f 1
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
37
src/hash.c
37
src/hash.c
@@ -1,37 +0,0 @@
|
||||
#include <string.h>
|
||||
#include "hash.h"
|
||||
|
||||
unsigned int hash_mem(const void *data, unsigned int len)
|
||||
{
|
||||
unsigned int h;
|
||||
unsigned int i;
|
||||
|
||||
h = len;
|
||||
|
||||
for (i = 0; i < len; ++i)
|
||||
h = ((h >> 27) ^ (h << 5)) ^ ((const unsigned char *)data)[i];
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
unsigned int hash_string(const char *value)
|
||||
{
|
||||
return hash_mem(value, strlen(value));
|
||||
}
|
||||
|
||||
unsigned int hash_u32(uint32_t value)
|
||||
{
|
||||
return value * 2654435761UL;
|
||||
}
|
||||
|
||||
unsigned int hash_u64(uint64_t value)
|
||||
{
|
||||
return hash_u32(value & 0xffffffff) ^ hash_u32(value >> 32);
|
||||
}
|
||||
|
||||
unsigned int hash_pointer(void *value)
|
||||
{
|
||||
if (sizeof(value) == sizeof(uint64_t))
|
||||
return hash_u64((long)value);
|
||||
return hash_u32((long)value);
|
||||
}
|
||||
12
src/hash.h
12
src/hash.h
@@ -1,12 +0,0 @@
|
||||
#ifndef _HASH_H_
|
||||
#define _HASH_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
unsigned int hash_mem(const void *data, unsigned int len);
|
||||
unsigned int hash_string(const char *value);
|
||||
unsigned int hash_u32(uint32_t value);
|
||||
unsigned int hash_u64(uint64_t value);
|
||||
unsigned int hash_pointer(void *value);
|
||||
|
||||
#endif
|
||||
130
src/list.h
130
src/list.h
@@ -1,130 +0,0 @@
|
||||
#ifndef _LIST_H_
|
||||
#define _LIST_H_
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#ifndef offsetof
|
||||
#define offsetof(type, md) ((size_t)&((type *)0)->md)
|
||||
#endif
|
||||
|
||||
#ifndef container_of
|
||||
#define container_of(ptr, type, member) \
|
||||
((type *)((char *)(ptr) - offsetof(type, member)))
|
||||
#endif
|
||||
|
||||
struct list_item {
|
||||
struct list_item *next;
|
||||
struct list_item *prev;
|
||||
};
|
||||
|
||||
struct list {
|
||||
struct list_item *head;
|
||||
struct list_item *tail;
|
||||
};
|
||||
|
||||
#define LIST_INIT(name) { 0, 0 }
|
||||
|
||||
#define LIST(name) \
|
||||
struct list name = LIST_INIT(name)
|
||||
|
||||
#define list_entry(ptr, type, member) \
|
||||
container_of(ptr, type, member)
|
||||
|
||||
static inline void list_init(struct list *list)
|
||||
{
|
||||
list->head = 0;
|
||||
list->tail = 0;
|
||||
}
|
||||
|
||||
static inline void list_append(struct list *list, struct list_item *item)
|
||||
{
|
||||
item->next = 0;
|
||||
item->prev = list->tail;
|
||||
if (list->tail != 0)
|
||||
list->tail->next = item;
|
||||
else
|
||||
list->head = item;
|
||||
list->tail = item;
|
||||
}
|
||||
|
||||
static inline void list_prepend(struct list *list, struct list_item *item)
|
||||
{
|
||||
item->prev = 0;
|
||||
item->next = list->head;
|
||||
if (list->head == 0)
|
||||
list->tail = item;
|
||||
list->head = item;
|
||||
}
|
||||
|
||||
static inline void list_insert(struct list *list, struct list_item *after, struct list_item *item)
|
||||
{
|
||||
if (after == 0) {
|
||||
list_prepend(list, item);
|
||||
return;
|
||||
}
|
||||
item->prev = after;
|
||||
item->next = after->next;
|
||||
after->next = item;
|
||||
if (item->next)
|
||||
item->next->prev = item;
|
||||
if (list->tail == after)
|
||||
list->tail = item;
|
||||
}
|
||||
|
||||
static inline void list_remove(struct list *list, struct list_item *item)
|
||||
{
|
||||
if (item->next)
|
||||
item->next->prev = item->prev;
|
||||
if (list->head == item) {
|
||||
list->head = item->next;
|
||||
if (list->head == 0)
|
||||
list->tail = 0;
|
||||
} else {
|
||||
item->prev->next = item->next;
|
||||
if (list->tail == item)
|
||||
list->tail = item->prev;
|
||||
}
|
||||
item->prev = item->next = 0;
|
||||
}
|
||||
|
||||
static inline struct list_item *list_pop(struct list *list)
|
||||
{
|
||||
struct list_item *item;
|
||||
item = list->head;
|
||||
if (item == 0)
|
||||
return 0;
|
||||
list_remove(list, item);
|
||||
return item;
|
||||
}
|
||||
|
||||
static inline struct list_item *list_last(struct list *list)
|
||||
{
|
||||
return list->tail;
|
||||
}
|
||||
|
||||
static inline struct list_item *list_first(struct list *list)
|
||||
{
|
||||
return list->head;
|
||||
}
|
||||
|
||||
|
||||
static inline struct list_item *list_next(struct list_item *item)
|
||||
{
|
||||
return item->next;
|
||||
}
|
||||
|
||||
#define list_push list_append
|
||||
|
||||
#define list_for_each(_list, _iter) \
|
||||
for (_iter = (_list)->head; (_iter) != 0; _iter = (_iter)->next)
|
||||
|
||||
#define list_for_each_after(_node, _iter) \
|
||||
for (_iter = (_node)->next; (_iter) != 0; _iter = (_iter)->next)
|
||||
|
||||
#define list_for_each_safe(_list, _iter, _bkup) \
|
||||
for (_iter = (_list)->head; (_iter) != 0 && ((_bkup = (_iter)->next) || 1); _iter = (_bkup))
|
||||
|
||||
#define list_for_each_safe_after(_node, _iter, _bkup) \
|
||||
for (_iter = (_node)->next; (_iter) != 0 && ((_bkup = (_iter)->next) || 1); _iter = (_bkup))
|
||||
|
||||
#endif
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
#include "logging.h"
|
||||
#include "ns.h"
|
||||
#include "util.h"
|
||||
|
||||
#define DIAG_SERVICE 4097
|
||||
|
||||
|
||||
233
src/map.c
233
src/map.c
@@ -1,233 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2008-2009, Courtney Cavin
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "map.h"
|
||||
|
||||
struct map_entry {
|
||||
struct map_item *item;
|
||||
};
|
||||
|
||||
/* Marker for deleted items */
|
||||
static struct map_item deleted;
|
||||
|
||||
void map_destroy(struct map *map)
|
||||
{
|
||||
free(map->data);
|
||||
}
|
||||
|
||||
void map_clear(struct map *map, void (*release)(struct map_item *))
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < map->size; ++i){
|
||||
if (!map->data[i].item)
|
||||
continue;
|
||||
if (map->data[i].item != &deleted)
|
||||
(* release)(map->data[i].item);
|
||||
map->data[i].item = NULL;
|
||||
}
|
||||
map->count = 0;
|
||||
}
|
||||
|
||||
int map_create(struct map *map)
|
||||
{
|
||||
map->size = 0;
|
||||
map->data = 0;
|
||||
map->count = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int map_hash(struct map *map, unsigned int key)
|
||||
{
|
||||
struct map_entry *e;
|
||||
int idx, i;
|
||||
|
||||
if (map->count == map->size)
|
||||
return -1;
|
||||
|
||||
idx = key % map->size;
|
||||
|
||||
for (i = 0; i < map->size; ++i) {
|
||||
e = &map->data[idx];
|
||||
if (!e->item || e->item == &deleted) {
|
||||
++map->count;
|
||||
return idx;
|
||||
}
|
||||
if (e->item->key == key)
|
||||
return idx;
|
||||
|
||||
idx = (idx + 1) % map->size;
|
||||
}
|
||||
|
||||
return -2;
|
||||
}
|
||||
|
||||
static int map_rehash(struct map *map);
|
||||
|
||||
int map_reput(struct map *map, unsigned int key, struct map_item *value,
|
||||
struct map_item **old)
|
||||
{
|
||||
int rc;
|
||||
|
||||
while ((rc = map_hash(map, key)) < 0) {
|
||||
if ((rc = map_rehash(map)) < 0)
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (old) {
|
||||
if (map->data[rc].item == &deleted)
|
||||
*old = NULL;
|
||||
else
|
||||
*old = map->data[rc].item;
|
||||
}
|
||||
map->data[rc].item = value;
|
||||
if (value)
|
||||
map->data[rc].item->key = key;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int map_put(struct map *map, unsigned int key, struct map_item *value)
|
||||
{
|
||||
return map_reput(map, key, value, NULL);
|
||||
}
|
||||
|
||||
static int map_rehash(struct map *map)
|
||||
{
|
||||
struct map_entry *oldt, *newt;
|
||||
int o_size, i;
|
||||
int rc;
|
||||
|
||||
newt = calloc(sizeof(struct map_entry), map->size + 256);
|
||||
if (!newt)
|
||||
return -1;
|
||||
|
||||
oldt = map->data;
|
||||
map->data = newt;
|
||||
|
||||
o_size = map->size;
|
||||
map->size += 256;
|
||||
map->count = 0;
|
||||
|
||||
for (i = 0; i < o_size; ++i){
|
||||
if (!oldt[i].item || oldt[i].item == &deleted)
|
||||
continue;
|
||||
rc = map_put(map, oldt[i].item->key, oldt[i].item);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
}
|
||||
|
||||
free(oldt);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct map_entry *map_find(const struct map *map, unsigned int key)
|
||||
{
|
||||
struct map_entry *e;
|
||||
int idx, i;
|
||||
|
||||
if (map->size == 0)
|
||||
return NULL;
|
||||
|
||||
idx = key % map->size;
|
||||
|
||||
for (i = 0; i < map->size; ++i) {
|
||||
e = &map->data[idx];
|
||||
idx = (idx + 1) % map->size;
|
||||
|
||||
if (!e->item)
|
||||
break;
|
||||
if (e->item == &deleted)
|
||||
continue;
|
||||
if (e->item->key == key)
|
||||
return e;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int map_contains(const struct map *map, unsigned int key)
|
||||
{
|
||||
return (map_find(map, key) == NULL) ? 0 : 1;
|
||||
}
|
||||
|
||||
struct map_item *map_get(const struct map *map, unsigned int key)
|
||||
{
|
||||
struct map_entry *e;
|
||||
|
||||
e = map_find(map, key);
|
||||
if (e == NULL)
|
||||
return NULL;
|
||||
return e->item;
|
||||
}
|
||||
|
||||
int map_remove(struct map *map, unsigned int key)
|
||||
{
|
||||
struct map_entry *e;
|
||||
|
||||
e = map_find(map, key);
|
||||
if (e) {
|
||||
e->item = &deleted;
|
||||
--map->count;
|
||||
}
|
||||
return !e;
|
||||
}
|
||||
|
||||
unsigned int map_length(struct map *map)
|
||||
{
|
||||
return map ? map->count : 0;
|
||||
}
|
||||
|
||||
static struct map_entry *map_iter_from(const struct map *map, unsigned int start)
|
||||
{
|
||||
unsigned int i = start;
|
||||
|
||||
for (; i < map->size; ++i) {
|
||||
if (map->data[i].item && map->data[i].item != &deleted)
|
||||
return &map->data[i];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct map_entry *map_iter_next(const struct map *map, struct map_entry *iter)
|
||||
{
|
||||
if (iter == NULL)
|
||||
return NULL;
|
||||
|
||||
return map_iter_from(map, (iter - map->data) + 1);
|
||||
}
|
||||
|
||||
struct map_entry *map_iter_first(const struct map *map)
|
||||
{
|
||||
return map_iter_from(map, 0);
|
||||
}
|
||||
|
||||
|
||||
struct map_item *map_iter_item(struct map_entry *iter)
|
||||
{
|
||||
return iter->item;
|
||||
}
|
||||
38
src/map.h
38
src/map.h
@@ -1,38 +0,0 @@
|
||||
#ifndef _MAP_H_
|
||||
#define _MAP_H_
|
||||
|
||||
struct map_item {
|
||||
unsigned int key;
|
||||
};
|
||||
|
||||
struct map_entry;
|
||||
|
||||
struct map {
|
||||
unsigned int size;
|
||||
unsigned int count;
|
||||
struct map_entry *data;
|
||||
};
|
||||
|
||||
int map_create(struct map *map);
|
||||
void map_destroy(struct map *map);
|
||||
void map_clear(struct map *map, void (*release)(struct map_item *));
|
||||
|
||||
int map_put(struct map *map, unsigned int key, struct map_item *v);
|
||||
int map_reput(struct map *map, unsigned int key, struct map_item *v,
|
||||
struct map_item **old);
|
||||
int map_contains(const struct map *map, unsigned int key);
|
||||
struct map_item *map_get(const struct map *map, unsigned int key);
|
||||
int map_remove(struct map *map, unsigned int key);
|
||||
unsigned int map_length(struct map *map);
|
||||
|
||||
struct map_entry *map_iter_first(const struct map *map);
|
||||
struct map_entry *map_iter_next(const struct map *map, struct map_entry *iter);
|
||||
struct map_item *map_iter_item(struct map_entry *iter);
|
||||
|
||||
#define map_for_each(map, iter) \
|
||||
for (iter = map_iter_first(map); iter; iter = map_iter_next(map, iter))
|
||||
|
||||
#define map_iter_data(iter, type, member) \
|
||||
container_of(map_iter_item(iter), type, member)
|
||||
|
||||
#endif
|
||||
@@ -1,30 +1,15 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
cfg_srcs = ['addr.c',
|
||||
'cfg.c',
|
||||
'hash.c']
|
||||
'cfg.c']
|
||||
executable('qrtr-cfg',
|
||||
cfg_srcs,
|
||||
link_with : libqrtr,
|
||||
include_directories : inc,
|
||||
install : true)
|
||||
|
||||
if with_qrtr_ns.enabled()
|
||||
ns_srcs = ['addr.c',
|
||||
'hash.c',
|
||||
'map.c',
|
||||
'ns.c',
|
||||
'util.c',
|
||||
'waiter.c']
|
||||
executable('qrtr-ns',
|
||||
ns_srcs,
|
||||
link_with : libqrtr,
|
||||
include_directories : inc,
|
||||
install : true)
|
||||
endif
|
||||
|
||||
executable('qrtr-lookup',
|
||||
'lookup.c',
|
||||
link_with : libqrtr,
|
||||
include_directories : inc,
|
||||
install : true)
|
||||
install : true)
|
||||
|
||||
18
src/util.c
18
src/util.c
@@ -1,18 +0,0 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include "util.h"
|
||||
|
||||
uint64_t time_ms(void)
|
||||
{
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
return (uint64_t)tv.tv_sec*1000 + tv.tv_usec/1000;
|
||||
}
|
||||
|
||||
void util_sleep(int ms)
|
||||
{
|
||||
usleep(ms * 1000);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
#ifndef __UTIL_H_
|
||||
#define __UTIL_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
uint64_t time_ms(void);
|
||||
void util_sleep(int ms);
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user