LCOV - code coverage report
Current view: top level - shared - sysctl-util.h (source / functions) Hit Total Coverage
Test: main_coverage.info Lines: 0 4 0.0 %
Date: 2019-08-22 15:41:25 Functions: 0 3 0.0 %

          Line data    Source code
       1             : /* SPDX-License-Identifier: LGPL-2.1+ */
       2             : #pragma once
       3             : 
       4             : #include <stdbool.h>
       5             : #include <stdint.h>
       6             : 
       7             : #include "macro.h"
       8             : #include "stdio-util.h"
       9             : #include "util.h"
      10             : 
      11             : char *sysctl_normalize(char *s);
      12             : int sysctl_read(const char *property, char **value);
      13             : int sysctl_write(const char *property, const char *value);
      14             : int sysctl_writef(const char *propery, const char *format, ...) _printf_(2, 3);
      15             : 
      16             : int sysctl_read_ip_property(int af, const char *ifname, const char *property, char **ret);
      17             : int sysctl_write_ip_property(int af, const char *ifname, const char *property, const char *value);
      18           0 : static inline int sysctl_write_ip_property_boolean(int af, const char *ifname, const char *property, bool value) {
      19           0 :         return sysctl_write_ip_property(af, ifname, property, one_zero(value));
      20             : }
      21             : 
      22             : #define DEFINE_SYSCTL_WRITE_IP_PROPERTY(name, type, format)           \
      23             :         static inline int sysctl_write_ip_property_##name(int af, const char *ifname, const char *property, type value) { \
      24             :                 char buf[DECIMAL_STR_MAX(type)];                        \
      25             :                 xsprintf(buf, format, value);                           \
      26             :                 return sysctl_write_ip_property(af, ifname, property, buf); \
      27             :         }
      28             : 
      29           0 : DEFINE_SYSCTL_WRITE_IP_PROPERTY(int, int, "%i");
      30           0 : DEFINE_SYSCTL_WRITE_IP_PROPERTY(uint32, uint32_t, "%" PRIu32);

Generated by: LCOV version 1.14