diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2021-06-30 01:39:43 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2021-06-30 01:39:43 +0000 |
commit | 0fda45c68b6a257ee26e9f9813cce8962f94e2fd (patch) | |
tree | f50f70b03d8908efe818e2c3adb6a1e6ffd72e41 /src/libs6rcd/s6rc_service_resolve.c | |
parent | 4c1d58b509c83ff788fe1ad6b5bdd1073977622c (diff) | |
download | s6-rc-0fda45c68b6a257ee26e9f9813cce8962f94e2fd.tar.xz |
New db design with mmap()
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/libs6rcd/s6rc_service_resolve.c')
-rw-r--r-- | src/libs6rcd/s6rc_service_resolve.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/libs6rcd/s6rc_service_resolve.c b/src/libs6rcd/s6rc_service_resolve.c index a786542..fe863be 100644 --- a/src/libs6rcd/s6rc_service_resolve.c +++ b/src/libs6rcd/s6rc_service_resolve.c @@ -9,10 +9,10 @@ #include "db.h" -int s6rc_service_resolve (cdb_t *c, s6rc_sid_t *id, char const *s) +int s6rc_service_resolve (cdb_t *c, char const *s, s6rc_id_t *id, char const **param) { size_t len = strlen(s) ; - char const *param = 0 ; + char const *p = 0 ; char pack[5] ; int r = cdb_find(c, s, len) ; if (r < 0) return r ; @@ -23,11 +23,9 @@ int s6rc_service_resolve (cdb_t *c, s6rc_sid_t *id, char const *s) if (at == len - 1) return (errno = EINVAL, -1) ; r = cdb_find(c, s, at + 1) ; if (r <= 0) return r ; - param = s + at + 1 ; + p = s + at + 1 ; } - if (cdb_read(c, pack, 5, cdb_datapos(c)) < 0) return -1 ; - id->stype = pack[0] ; - uint32_unpack_big(pack + 1, &id->i) ; - id->param = param ; + uint32_unpack_big(cdb_datapos(c), id) ; + *param = p ; return 1 ; } |