mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-12 09:17:44 +03:00
util: introduce format_ifname()
This commit is contained in:
parent
658e910640
commit
7f686722f7
10
src/basic/format-util.c
Normal file
10
src/basic/format-util.c
Normal file
@ -0,0 +1,10 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||
|
||||
#include "format-util.h"
|
||||
#include "memory-util.h"
|
||||
|
||||
char *format_ifname(int ifindex, char buf[static IF_NAMESIZE + 1]) {
|
||||
/* Buffer is always cleared */
|
||||
memzero(buf, IF_NAMESIZE + 1);
|
||||
return if_indextoname(ifindex, buf);
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#if SIZEOF_PID_T == 4
|
||||
# define PID_PRI PRIi32
|
||||
@ -65,3 +66,5 @@
|
||||
#else
|
||||
# error Unknown ino_t size
|
||||
#endif
|
||||
|
||||
char *format_ifname(int ifindex, char buf[static IF_NAMESIZE + 1]);
|
||||
|
@ -56,6 +56,7 @@ basic_sources = files('''
|
||||
fd-util.h
|
||||
fileio.c
|
||||
fileio.h
|
||||
format-util.c
|
||||
format-util.h
|
||||
fs-util.c
|
||||
fs-util.h
|
||||
|
Loading…
Reference in New Issue
Block a user