mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-30 23:40:10 +01:00
dhcp: cleanup internal systemd dhcp library
Merge first part of patches that prepare for updating the dhcp library to new systemd upstream. https://bugzilla.gnome.org/show_bug.cgi?id=742719
This commit is contained in:
commit
def82cddea
45 changed files with 100 additions and 78 deletions
|
|
@ -57,7 +57,7 @@ G_STMT_START { \
|
|||
if (nm_logging_enabled (_l, LOGD_DHCP)) { \
|
||||
const char *_location = strrchr (file "", '/'); \
|
||||
\
|
||||
_nm_log (_location ? _location + 1 : file, line, func, _l, LOGD_DHCP, format, ## __VA_ARGS__); \
|
||||
_nm_log (_location ? _location + 1 : file, line, func, _l, LOGD_DHCP, 0, format, ## __VA_ARGS__); \
|
||||
} \
|
||||
} G_STMT_END
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@
|
|||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <linux/if_packet.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@
|
|||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
#include <errno.h>
|
||||
|
|
|
|||
|
|
@ -19,8 +19,6 @@
|
|||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
|
|
|||
|
|
@ -18,8 +18,6 @@
|
|||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
#include <netinet/udp.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <stdint.h>
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@
|
|||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
#include <errno.h>
|
||||
|
|
|
|||
|
|
@ -19,8 +19,6 @@
|
|||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
#include <netinet/ip6.h>
|
||||
#include <netinet/udp.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -19,8 +19,6 @@
|
|||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
#include <netinet/ether.h>
|
||||
|
|
@ -32,17 +30,17 @@
|
|||
#include "strv.h"
|
||||
#include "siphash24.h"
|
||||
#include "libudev-private.h"
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
#include "dhcp-lease-internal.h"
|
||||
#if 0 /* NM_IGNORED */
|
||||
#include "log.h"
|
||||
#include "utf8.h"
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
#include "util.h"
|
||||
#if 0 /* NM_IGNORED */
|
||||
#include "conf-parser.h"
|
||||
#include "condition.h"
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
#include "network-internal.h"
|
||||
|
||||
#if 0 /* NM_IGNORED */
|
||||
|
|
@ -306,7 +304,7 @@ int config_parse_hwaddr(const char *unit,
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
|
||||
void serialize_in_addrs(FILE *f, const struct in_addr *addresses, size_t size) {
|
||||
unsigned i;
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ int config_parse_ifalias(const char *unit, const char *filename, unsigned line,
|
|||
|
||||
int net_get_unique_predictable_data(struct udev_device *device, uint8_t result[8]);
|
||||
const char *net_get_name(struct udev_device *device);
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
|
||||
void serialize_in_addrs(FILE *f, const struct in_addr *addresses, size_t size);
|
||||
int deserialize_in_addrs(struct in_addr **addresses, const char *string);
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@
|
|||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
|
|
|||
|
|
@ -18,8 +18,6 @@
|
|||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
|
@ -34,7 +32,7 @@
|
|||
#include "list.h"
|
||||
#if 0 /* NM_IGNORED */
|
||||
#include "mkdir.h"
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
#include "fileio.h"
|
||||
#include "unaligned.h"
|
||||
#include "in-addr-util.h"
|
||||
|
|
|
|||
|
|
@ -19,8 +19,6 @@
|
|||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
#include <errno.h>
|
||||
|
|
@ -32,7 +30,7 @@
|
|||
#include "udev.h"
|
||||
#include "udev-util.h"
|
||||
#include "virt.h"
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
#include "siphash24.h"
|
||||
#include "util.h"
|
||||
#include "refcnt.h"
|
||||
|
|
@ -1180,7 +1178,7 @@ int sd_dhcp6_client_new(sd_dhcp6_client **ret)
|
|||
#if 0 /* NM_IGNORED */
|
||||
sd_id128_t machine_id;
|
||||
int r;
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
size_t t;
|
||||
|
||||
assert_return(ret, -EINVAL);
|
||||
|
|
@ -1210,7 +1208,7 @@ int sd_dhcp6_client_new(sd_dhcp6_client **ret)
|
|||
/* a bit of snake-oil perhaps, but no need to expose the machine-id
|
||||
directly */
|
||||
siphash24(client->duid.en.id, &machine_id, sizeof(machine_id), HASH_KEY.bytes);
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
|
||||
client->req_opts_len = ELEMENTSOF(default_req_opts);
|
||||
|
||||
|
|
|
|||
|
|
@ -18,8 +18,6 @@
|
|||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
#include <errno.h>
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
int asynchronous_job(void* (*func)(void *p), void *arg);
|
||||
|
||||
int asynchronous_sync(void);
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include "config.h"
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,9 @@
|
|||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include "config.h"
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
#include <arpa/inet.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include "macro.h"
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
/* The head of the linked list. Use this in the structure that shall
|
||||
* contain the head of the linked list */
|
||||
#define LIST_HEAD(t,name) \
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
|
|
@ -410,4 +412,4 @@ do { \
|
|||
#endif
|
||||
|
||||
#include "log.h"
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
/* A type-safe atomic refcounter */
|
||||
|
||||
typedef struct {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@
|
|||
|
||||
(Minimal changes made by Lennart Poettering, to make clean for inclusion in systemd)
|
||||
*/
|
||||
#include "config.h"
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/ether.h>
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
#ifndef SPARSE_ENDIAN_H
|
||||
#define SPARSE_ENDIAN_H
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
#include <byteswap.h>
|
||||
#include <endian.h>
|
||||
#include <stdint.h>
|
||||
|
|
|
|||
|
|
@ -19,8 +19,6 @@
|
|||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
|
@ -312,7 +310,7 @@ int strv_split_quoted(char ***t, const char *s, bool relax) {
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
|
||||
char *strv_join(char **l, const char *separator) {
|
||||
char *r, *e;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -19,8 +19,6 @@
|
|||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
#include <time.h>
|
||||
|
|
@ -32,7 +30,7 @@
|
|||
#include "time-util.h"
|
||||
#if 0 /* NM_IGNORED */
|
||||
#include "strv.h"
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
|
||||
usec_t now(clockid_t clock_id) {
|
||||
struct timespec ts;
|
||||
|
|
@ -279,7 +277,7 @@ char *format_timestamp_relative(char *buf, size_t l, usec_t t) {
|
|||
buf[l-1] = 0;
|
||||
return buf;
|
||||
}
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
|
||||
char *format_timespan(char *buf, size_t l, usec_t t, usec_t accuracy) {
|
||||
static const struct {
|
||||
|
|
@ -981,7 +979,7 @@ bool timezone_is_valid(const char *name) {
|
|||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
|
||||
clockid_t clock_boottime_or_monotonic(void) {
|
||||
static clockid_t clock = -1;
|
||||
|
|
|
|||
|
|
@ -21,14 +21,14 @@
|
|||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
typedef uint64_t usec_t;
|
||||
typedef uint64_t nsec_t;
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
#define NSEC_FMT "%" PRIu64
|
||||
#define USEC_FMT "%" PRIu64
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
static inline uint16_t unaligned_read_be16(const void *_u) {
|
||||
|
|
|
|||
|
|
@ -43,8 +43,6 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
#include <errno.h>
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "macro.h"
|
||||
|
|
|
|||
|
|
@ -19,8 +19,6 @@
|
|||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
|
@ -90,7 +88,7 @@
|
|||
#include "gunicode.h"
|
||||
#include "virt.h"
|
||||
#include "def.h"
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
|
||||
#if 0 /* NM_IGNORED */
|
||||
int saved_argc = 0;
|
||||
|
|
@ -112,7 +110,7 @@ size_t page_size(void) {
|
|||
pgsz = (size_t) r;
|
||||
return pgsz;
|
||||
}
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
|
||||
bool streq_ptr(const char *a, const char *b) {
|
||||
|
||||
|
|
@ -311,7 +309,7 @@ int parse_uid(const char *s, uid_t* ret_uid) {
|
|||
*ret_uid = uid;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
|
||||
int safe_atou(const char *s, unsigned *ret_u) {
|
||||
char *x = NULL;
|
||||
|
|
@ -466,7 +464,7 @@ int safe_atod(const char *s, double *ret_d) {
|
|||
*ret_d = (double) d;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
|
||||
static size_t strcspn_escaped(const char *s, const char *reject) {
|
||||
bool escaped = false;
|
||||
|
|
@ -617,7 +615,7 @@ int get_starttime_of_pid(pid_t pid, unsigned long long *st) {
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
|
||||
int fchmod_umask(int fd, mode_t m) {
|
||||
mode_t u;
|
||||
|
|
@ -875,7 +873,7 @@ int get_process_gid(pid_t pid, gid_t *gid) {
|
|||
assert_cc(sizeof(uid_t) == sizeof(gid_t));
|
||||
return get_process_id(pid, "Gid:", gid);
|
||||
}
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
|
||||
char *strnappend(const char *s, const char *suffix, size_t b) {
|
||||
size_t a;
|
||||
|
|
@ -1049,7 +1047,7 @@ int reset_signal_mask(void) {
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
|
||||
char *strstrip(char *s) {
|
||||
char *e;
|
||||
|
|
@ -1158,7 +1156,7 @@ int rmdir_parents(const char *path, const char *stop) {
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
|
||||
char hexchar(int x) {
|
||||
static const char table[16] = "0123456789abcdef";
|
||||
|
|
@ -1646,7 +1644,7 @@ int close_all_fds(const int except[], unsigned n_except) {
|
|||
|
||||
return r;
|
||||
}
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
|
||||
bool chars_intersect(const char *a, const char *b) {
|
||||
const char *p;
|
||||
|
|
@ -2269,7 +2267,7 @@ void safe_close_pair(int p[]) {
|
|||
p[0] = safe_close(p[0]);
|
||||
p[1] = safe_close(p[1]);
|
||||
}
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
|
||||
ssize_t loop_read(int fd, void *buf, size_t nbytes, bool do_poll) {
|
||||
uint8_t *p = buf;
|
||||
|
|
@ -2551,7 +2549,7 @@ char* dirname_malloc(const char *path) {
|
|||
|
||||
return dir;
|
||||
}
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
|
||||
int dev_urandom(void *p, size_t n) {
|
||||
#if 0 /* NM_IGNORED */
|
||||
|
|
@ -2597,7 +2595,7 @@ int dev_urandom(void *p, size_t n) {
|
|||
#else /* NM IGNORED */
|
||||
int fd;
|
||||
ssize_t k;
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
|
||||
fd = open("/dev/urandom", O_RDONLY|O_CLOEXEC|O_NOCTTY);
|
||||
if (fd < 0)
|
||||
|
|
@ -3342,7 +3340,6 @@ fail:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#if 0 /* NM_IGNORED */
|
||||
char **replace_env_argv(char **argv, char **env) {
|
||||
char **ret, **i;
|
||||
unsigned k = 0, l = 0;
|
||||
|
|
@ -3407,7 +3404,6 @@ char **replace_env_argv(char **argv, char **env) {
|
|||
ret[k] = NULL;
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
int fd_columns(int fd) {
|
||||
struct winsize ws = {};
|
||||
|
|
@ -4171,7 +4167,7 @@ char* strshorten(char *s, size_t l) {
|
|||
|
||||
return s;
|
||||
}
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
|
||||
static bool hostname_valid_char(char c) {
|
||||
return
|
||||
|
|
@ -4274,7 +4270,7 @@ int pipe_eof(int fd) {
|
|||
|
||||
return pollfd.revents & POLLHUP;
|
||||
}
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
|
||||
int fd_wait_for_event(int fd, int event, usec_t t) {
|
||||
|
||||
|
|
@ -4807,7 +4803,7 @@ int get_files_in_directory(const char *path, char ***list) {
|
|||
|
||||
return n;
|
||||
}
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
|
||||
char *strjoin(const char *x, ...) {
|
||||
va_list ap;
|
||||
|
|
@ -5174,7 +5170,7 @@ finish:
|
|||
return buf;
|
||||
|
||||
}
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
|
||||
void* memdup(const void *p, size_t l) {
|
||||
void *r;
|
||||
|
|
@ -5621,7 +5617,7 @@ bool string_is_safe(const char *p) {
|
|||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
|
||||
/**
|
||||
* Check if a string contains control characters. If 'ok' is non-NULL
|
||||
|
|
@ -6124,7 +6120,7 @@ char *strrep(const char *s, unsigned n) {
|
|||
*p = 0;
|
||||
return r;
|
||||
}
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
|
||||
void* greedy_realloc(void **p, size_t *allocated, size_t need, size_t size) {
|
||||
size_t a, newalloc;
|
||||
|
|
@ -6540,7 +6536,7 @@ int getpeersec(int fd, char **ret) {
|
|||
*ret = s;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
|
||||
/* This is much like like mkostemp() but is subject to umask(). */
|
||||
int mkostemp_safe(char *pattern, int flags) {
|
||||
|
|
@ -6945,7 +6941,7 @@ int bind_remount_recursive(const char *prefix, bool ro) {
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
|
||||
int fflush_and_check(FILE *f) {
|
||||
assert(f);
|
||||
|
|
@ -7007,7 +7003,7 @@ char *tempfn_random(const char *p) {
|
|||
|
||||
return t;
|
||||
}
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
|
||||
/* make sure the hostname is not "localhost" */
|
||||
bool is_localhost(const char *hostname) {
|
||||
|
|
@ -7346,5 +7342,5 @@ int sethostname_idempotent(const char *s) {
|
|||
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
|
||||
|
|
|
|||
|
|
@ -85,12 +85,12 @@
|
|||
#else
|
||||
# error Unknown rlim_t size
|
||||
#endif
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
|
||||
#include "macro.h"
|
||||
#if 0 /* NM_IGNORED */
|
||||
#include "missing.h"
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
#include "time-util.h"
|
||||
|
||||
/* What is interpreted as whitespace? */
|
||||
|
|
@ -987,7 +987,7 @@ bool pid_is_unwaited(pid_t pid);
|
|||
#if 0 /* NM_IGNORED */
|
||||
int getpeercred(int fd, struct ucred *ucred);
|
||||
int getpeersec(int fd, char **ret);
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
|
||||
int writev_safe(int fd, const struct iovec *w, int j);
|
||||
|
||||
|
|
@ -1010,7 +1010,7 @@ union file_handle_union {
|
|||
struct file_handle handle;
|
||||
char padding[sizeof(struct file_handle) + MAX_HANDLE_SZ];
|
||||
};
|
||||
#endif
|
||||
#endif /* NM_IGNORED */
|
||||
|
||||
int update_reboot_param_file(const char *param);
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@
|
|||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
/* This is a private header; never even think of including this directly! */
|
||||
|
||||
#if __INCLUDE_LEVEL__ <= 1
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@
|
|||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <net/ethernet.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@
|
|||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <net/ethernet.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@
|
|||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
#include <net/ethernet.h>
|
||||
|
||||
#include "sd-event.h"
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@
|
|||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
typedef struct sd_dhcp6_lease sd_dhcp6_lease;
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@
|
|||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/signalfd.h>
|
||||
#include <sys/epoll.h>
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@
|
|||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include "nm-sd-adapt.h"
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -365,6 +365,7 @@ _nm_log (const char *file,
|
|||
const char *func,
|
||||
NMLogLevel level,
|
||||
NMLogDomain domain,
|
||||
int error,
|
||||
const char *fmt,
|
||||
...)
|
||||
{
|
||||
|
|
@ -382,6 +383,10 @@ _nm_log (const char *file,
|
|||
if (!(logging[level] & domain))
|
||||
return;
|
||||
|
||||
/* Make sure that %m maps to the specified error */
|
||||
if (error != 0)
|
||||
errno = error;
|
||||
|
||||
va_start (args, fmt);
|
||||
msg = g_strdup_vprintf (fmt, args);
|
||||
va_end (args);
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ typedef enum { /*< skip >*/
|
|||
#define nm_log(level, domain, ...) \
|
||||
G_STMT_START { \
|
||||
if (nm_logging_enabled ((level), (domain))) { \
|
||||
_nm_log (__FILE__, __LINE__, G_STRFUNC, (level), (domain), __VA_ARGS__); \
|
||||
_nm_log (__FILE__, __LINE__, G_STRFUNC, (level), (domain), 0, __VA_ARGS__); \
|
||||
} \
|
||||
} G_STMT_END
|
||||
|
||||
|
|
@ -139,8 +139,9 @@ void _nm_log (const char *file,
|
|||
const char *func,
|
||||
NMLogLevel level,
|
||||
NMLogDomain domain,
|
||||
int error,
|
||||
const char *fmt,
|
||||
...) __attribute__((__format__ (__printf__, 6, 7)));
|
||||
...) __attribute__((__format__ (__printf__, 7, 8)));
|
||||
|
||||
const char *nm_logging_level_to_string (void);
|
||||
const char *nm_logging_domains_to_string (void);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue