Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
39bb4b35
Commit
39bb4b35
authored
Nov 08, 2014
by
Matthias Vallentin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused code.
parent
8f30f19c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
51 deletions
+0
-51
libcaf_core/src/get_root_uuid.cpp
libcaf_core/src/get_root_uuid.cpp
+0
-51
No files found.
libcaf_core/src/get_root_uuid.cpp
View file @
39bb4b35
...
...
@@ -65,19 +65,11 @@ std::string get_root_uuid() {
#include <vector>
#include <string>
#include <cctype>
#include <fstream>
#include <sstream>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <stdio.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>
#include <cstring>
#include <unistd.h>
#include <iostream>
#include "caf/string_algorithms.hpp"
...
...
@@ -123,49 +115,6 @@ bool operator!=(const columns_iterator& lhs, const columns_iterator& rhs) {
}
// namespace <anonymous>
std
::
string
get_root_uuid
()
{
int
sck
=
socket
(
AF_INET
,
SOCK_DGRAM
,
0
);
if
(
sck
<
0
)
{
perror
(
"socket"
);
return
""
;
}
// query available interfaces
char
buf
[
1024
];
ifconf
ifc
;
ifc
.
ifc_len
=
sizeof
(
buf
);
ifc
.
ifc_buf
=
buf
;
if
(
ioctl
(
sck
,
SIOCGIFCONF
,
&
ifc
)
<
0
)
{
perror
(
"ioctl(SIOCGIFCONF)"
);
return
""
;
}
vector
<
string
>
hw_addresses
;
auto
ctoi
=
[](
char
c
)
->
unsigned
{
return
static_cast
<
unsigned
char
>
(
c
);
};
// iterate through interfaces.
auto
ifr
=
ifc
.
ifc_req
;
size_t
num_ifs
=
ifc
.
ifc_len
/
sizeof
(
ifreq
);
for
(
size_t
i
=
0
;
i
<
num_ifs
;
i
++
)
{
auto
&
item
=
ifr
[
i
];
// get MAC address
if
(
ioctl
(
sck
,
SIOCGIFHWADDR
,
&
item
)
<
0
)
{
perror
(
"ioctl(SIOCGIFHWADDR)"
);
return
""
;
}
// convert MAC address to standard string representation
std
::
ostringstream
oss
;
oss
<<
std
::
hex
;
oss
.
width
(
2
);
oss
<<
ctoi
(
item
.
ifr_hwaddr
.
sa_data
[
0
]);
for
(
size_t
i
=
1
;
i
<
6
;
++
i
)
{
oss
<<
":"
;
oss
.
width
(
2
);
oss
<<
ctoi
(
item
.
ifr_hwaddr
.
sa_data
[
i
]);
}
auto
addr
=
oss
.
str
();
if
(
addr
!=
"00:00:00:00:00:00"
)
{
hw_addresses
.
push_back
(
std
::
move
(
addr
));
}
}
string
uuid
;
ifstream
fs
;
fs
.
open
(
"/etc/fstab"
,
std
::
ios_base
::
in
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment