Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
9aff1a57
Commit
9aff1a57
authored
Nov 19, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup headers
parent
7681fde4
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
45 additions
and
89 deletions
+45
-89
api.cpp
native/jni/magiskpolicy/api.cpp
+5
-0
magiskpolicy.h
native/jni/magiskpolicy/magiskpolicy.h
+0
-4
sepolicy.c
native/jni/magiskpolicy/sepolicy.c
+12
-11
sepolicy.h
native/jni/magiskpolicy/sepolicy.h
+5
-5
hacks.h
native/jni/systemproperties/include/hacks.h
+1
-1
files.h
native/jni/utils/files.h
+3
-12
logging.h
native/jni/utils/include/logging.h
+2
-9
selinux.h
native/jni/utils/include/selinux.h
+0
-4
misc.h
native/jni/utils/misc.h
+12
-24
missing.h
native/jni/utils/missing.h
+0
-4
xwrap.h
native/jni/utils/xwrap.h
+5
-15
No files found.
native/jni/magiskpolicy/api.cpp
View file @
9aff1a57
...
@@ -51,6 +51,11 @@ int sepol_typemember(const char *s, const char *t, const char *c, const char *d)
...
@@ -51,6 +51,11 @@ int sepol_typemember(const char *s, const char *t, const char *c, const char *d)
return
add_type_rule
(
s
,
t
,
c
,
d
,
AVTAB_MEMBER
);
return
add_type_rule
(
s
,
t
,
c
,
d
,
AVTAB_MEMBER
);
}
}
int
sepol_nametrans
(
const
char
*
s
,
const
char
*
t
,
const
char
*
c
,
const
char
*
d
,
const
char
*
o
)
{
// printf("name_trans %s %s %s %s %s\n", s, t, c, d, o);
return
add_filename_trans
(
s
,
t
,
c
,
d
,
o
);
}
int
sepol_permissive
(
const
char
*
s
)
{
int
sepol_permissive
(
const
char
*
s
)
{
// printf("permissive %s\n", s);
// printf("permissive %s\n", s);
return
set_domain_state
(
s
,
1
);
return
set_domain_state
(
s
,
1
);
...
...
native/jni/magiskpolicy/magiskpolicy.h
View file @
9aff1a57
...
@@ -8,8 +8,6 @@
...
@@ -8,8 +8,6 @@
#define ALL NULL
#define ALL NULL
__BEGIN_DECLS
// policydb functions
// policydb functions
int
load_policydb
(
const
char
*
file
);
int
load_policydb
(
const
char
*
file
);
int
load_split_cil
();
int
load_split_cil
();
...
@@ -37,5 +35,3 @@ int sepol_exists(const char *source);
...
@@ -37,5 +35,3 @@ int sepol_exists(const char *source);
// Built in rules
// Built in rules
void
sepol_magisk_rules
();
void
sepol_magisk_rules
();
__END_DECLS
native/jni/magiskpolicy/sepolicy.c
View file @
9aff1a57
#include <stdlib.h>
#include <stdlib.h>
#include <sepol/policydb/expand.h>
#include <sepol/policydb/expand.h>
#include <utils.h>
#include <logging.h>
#include <logging.h>
#include "magiskpolicy.h"
#include "sepolicy.h"
#include "sepolicy.h"
extern
void
*
xmalloc
(
size_t
size
);
extern
void
*
xcalloc
(
size_t
nmemb
,
size_t
size
);
extern
void
*
xrealloc
(
void
*
ptr
,
size_t
size
);
extern
int
policydb_index_decls
(
sepol_handle_t
*
handle
,
policydb_t
*
p
);
extern
int
policydb_index_decls
(
sepol_handle_t
*
handle
,
policydb_t
*
p
);
static
int
get_attr
(
const
char
*
type
,
int
value
)
{
static
int
get_attr
(
const
char
*
type
,
int
value
)
{
...
@@ -39,9 +40,9 @@ static int set_attr(const char *type, int value) {
...
@@ -39,9 +40,9 @@ static int set_attr(const char *type, int value) {
if
(
attr
->
flavor
!=
TYPE_ATTRIB
)
if
(
attr
->
flavor
!=
TYPE_ATTRIB
)
return
1
;
return
1
;
if
(
ebitmap_set_bit
(
&
policydb
->
type_attr_map
[
value
-
1
],
attr
->
s
.
value
-
1
,
1
))
if
(
ebitmap_set_bit
(
&
policydb
->
type_attr_map
[
value
-
1
],
attr
->
s
.
value
-
1
,
1
))
return
1
;
return
1
;
if
(
ebitmap_set_bit
(
&
policydb
->
attr_type_map
[
attr
->
s
.
value
-
1
],
value
-
1
,
1
))
if
(
ebitmap_set_bit
(
&
policydb
->
attr_type_map
[
attr
->
s
.
value
-
1
],
value
-
1
,
1
))
return
1
;
return
1
;
return
0
;
return
0
;
...
@@ -223,7 +224,7 @@ int create_domain(const char *d) {
...
@@ -223,7 +224,7 @@ int create_domain(const char *d) {
return
0
;
return
0
;
}
}
type_datum_t
*
typedatum
=
(
type_datum_t
*
)
malloc
(
sizeof
(
type_datum_t
));
type_datum_t
*
typedatum
=
(
type_datum_t
*
)
x
malloc
(
sizeof
(
type_datum_t
));
type_datum_init
(
typedatum
);
type_datum_init
(
typedatum
);
typedatum
->
primary
=
1
;
typedatum
->
primary
=
1
;
typedatum
->
flavor
=
TYPE_TYPE
;
typedatum
->
flavor
=
TYPE_TYPE
;
...
@@ -236,8 +237,8 @@ int create_domain(const char *d) {
...
@@ -236,8 +237,8 @@ int create_domain(const char *d) {
return
1
;
return
1
;
}
}
policydb
->
type_attr_map
=
realloc
(
policydb
->
type_attr_map
,
sizeof
(
ebitmap_t
)
*
policydb
->
p_types
.
nprim
);
policydb
->
type_attr_map
=
x
realloc
(
policydb
->
type_attr_map
,
sizeof
(
ebitmap_t
)
*
policydb
->
p_types
.
nprim
);
policydb
->
attr_type_map
=
realloc
(
policydb
->
attr_type_map
,
sizeof
(
ebitmap_t
)
*
policydb
->
p_types
.
nprim
);
policydb
->
attr_type_map
=
x
realloc
(
policydb
->
attr_type_map
,
sizeof
(
ebitmap_t
)
*
policydb
->
p_types
.
nprim
);
ebitmap_init
(
&
policydb
->
type_attr_map
[
value
-
1
]);
ebitmap_init
(
&
policydb
->
type_attr_map
[
value
-
1
]);
ebitmap_init
(
&
policydb
->
attr_type_map
[
value
-
1
]);
ebitmap_init
(
&
policydb
->
attr_type_map
[
value
-
1
]);
ebitmap_set_bit
(
&
policydb
->
type_attr_map
[
value
-
1
],
value
-
1
,
1
);
ebitmap_set_bit
(
&
policydb
->
type_attr_map
[
value
-
1
],
value
-
1
,
1
);
...
@@ -292,7 +293,7 @@ int set_domain_state(const char *s, int state) {
...
@@ -292,7 +293,7 @@ int set_domain_state(const char *s, int state) {
return
0
;
return
0
;
}
}
int
sepol_name
trans
(
const
char
*
s
,
const
char
*
t
,
const
char
*
c
,
const
char
*
d
,
const
char
*
o
)
{
int
add_filename_
trans
(
const
char
*
s
,
const
char
*
t
,
const
char
*
c
,
const
char
*
d
,
const
char
*
o
)
{
type_datum_t
*
src
,
*
tgt
,
*
def
;
type_datum_t
*
src
,
*
tgt
,
*
def
;
class_datum_t
*
cls
;
class_datum_t
*
cls
;
...
@@ -350,12 +351,12 @@ int add_typeattribute(const char *domainS, const char *attr) {
...
@@ -350,12 +351,12 @@ int add_typeattribute(const char *domainS, const char *attr) {
int
typeId
=
get_attr_id
(
attr
);
int
typeId
=
get_attr_id
(
attr
);
//Now let's update all constraints!
//Now let's update all constraints!
//(kernel doesn't support (yet?) type_names rules)
//(kernel doesn't support (yet?) type_names rules)
for
(
int
i
=
0
;
i
<
policydb
->
p_classes
.
nprim
;
++
i
)
{
for
(
int
i
=
0
;
i
<
policydb
->
p_classes
.
nprim
;
++
i
)
{
class_datum_t
*
cl
=
policydb
->
class_val_to_struct
[
i
];
class_datum_t
*
cl
=
policydb
->
class_val_to_struct
[
i
];
for
(
constraint_node_t
*
n
=
cl
->
constraints
;
n
;
n
=
n
->
next
)
{
for
(
constraint_node_t
*
n
=
cl
->
constraints
;
n
;
n
=
n
->
next
)
{
for
(
constraint_expr_t
*
e
=
n
->
expr
;
e
;
e
=
e
->
next
)
{
for
(
constraint_expr_t
*
e
=
n
->
expr
;
e
;
e
=
e
->
next
)
{
if
(
e
->
expr_type
==
CEXPR_NAMES
)
{
if
(
e
->
expr_type
==
CEXPR_NAMES
)
{
if
(
ebitmap_get_bit
(
&
e
->
type_names
->
types
,
typeId
-
1
))
{
if
(
ebitmap_get_bit
(
&
e
->
type_names
->
types
,
typeId
-
1
))
{
ebitmap_set_bit
(
&
e
->
names
,
domain
->
s
.
value
-
1
,
1
);
ebitmap_set_bit
(
&
e
->
names
,
domain
->
s
.
value
-
1
,
1
);
}
}
}
}
...
...
native/jni/magiskpolicy/sepolicy.h
View file @
9aff1a57
/* sepolicy.h - Header for magiskpolicy non-public APIs
*/
#pragma once
#pragma once
#include <sepol/policydb/policydb.h>
#include <sepol/policydb/policydb.h>
...
@@ -21,10 +18,12 @@ extern policydb_t *policydb;
...
@@ -21,10 +18,12 @@ extern policydb_t *policydb;
} \
} \
// hashtab traversal
// hashtab traversal
#define hashtab_for_each(hashtab, cur, block) hash_for_each(htable, size, hashtab, cur, block)
#define hashtab_for_each(hashtab, cur, block) \
hash_for_each(htable, size, hashtab, cur, block)
// avtab traversal
// avtab traversal
#define avtab_for_each(avtab, cur, block) hash_for_each(htable, nslot, avtab, cur, block)
#define avtab_for_each(avtab, cur, block) \
hash_for_each(htable, nslot, avtab, cur, block)
int
create_domain
(
const
char
*
d
);
int
create_domain
(
const
char
*
d
);
int
set_domain_state
(
const
char
*
s
,
int
state
);
int
set_domain_state
(
const
char
*
s
,
int
state
);
...
@@ -32,5 +31,6 @@ int add_typeattribute(const char *domainS, const char *attr);
...
@@ -32,5 +31,6 @@ int add_typeattribute(const char *domainS, const char *attr);
int
add_rule
(
const
char
*
s
,
const
char
*
t
,
const
char
*
c
,
const
char
*
p
,
int
effect
,
int
n
);
int
add_rule
(
const
char
*
s
,
const
char
*
t
,
const
char
*
c
,
const
char
*
p
,
int
effect
,
int
n
);
int
add_xperm_rule
(
const
char
*
s
,
const
char
*
t
,
const
char
*
c
,
const
char
*
range
,
int
effect
,
int
n
);
int
add_xperm_rule
(
const
char
*
s
,
const
char
*
t
,
const
char
*
c
,
const
char
*
range
,
int
effect
,
int
n
);
int
add_type_rule
(
const
char
*
s
,
const
char
*
t
,
const
char
*
c
,
const
char
*
d
,
int
effect
);
int
add_type_rule
(
const
char
*
s
,
const
char
*
t
,
const
char
*
c
,
const
char
*
d
,
int
effect
);
int
add_filename_trans
(
const
char
*
s
,
const
char
*
t
,
const
char
*
c
,
const
char
*
d
,
const
char
*
o
);
__END_DECLS
__END_DECLS
native/jni/systemproperties/include/hacks.h
View file @
9aff1a57
...
@@ -11,4 +11,4 @@
...
@@ -11,4 +11,4 @@
#endif
#endif
#define getline __getline
#define getline __getline
#define fsetxattr(...) syscall(__NR_fsetxattr, __VA_ARGS__)
#define fsetxattr(...) syscall(__NR_fsetxattr, __VA_ARGS__)
extern
"C"
ssize_t
__getline
(
char
**
,
size_t
*
,
FILE
*
);
ssize_t
__getline
(
char
**
,
size_t
*
,
FILE
*
);
native/jni/utils/files.h
View file @
9aff1a57
#pragma once
#pragma once
#include <functional>
#include <string_view>
#define do_align(p, a) (((p) + (a) - 1) / (a) * (a))
#define do_align(p, a) (((p) + (a) - 1) / (a) * (a))
#define align_off(p, a) (do_align(p, a) - (p))
#define align_off(p, a) (do_align(p, a) - (p))
...
@@ -8,10 +11,6 @@ struct file_attr {
...
@@ -8,10 +11,6 @@ struct file_attr {
char
con
[
128
];
char
con
[
128
];
};
};
#ifdef __cplusplus
extern
"C"
{
#endif
ssize_t
fd_path
(
int
fd
,
char
*
path
,
size_t
size
);
ssize_t
fd_path
(
int
fd
,
char
*
path
,
size_t
size
);
int
fd_pathat
(
int
dirfd
,
const
char
*
name
,
char
*
path
,
size_t
size
);
int
fd_pathat
(
int
dirfd
,
const
char
*
name
,
char
*
path
,
size_t
size
);
int
mkdirs
(
const
char
*
pathname
,
mode_t
mode
);
int
mkdirs
(
const
char
*
pathname
,
mode_t
mode
);
...
@@ -32,12 +31,6 @@ void fd_full_read(int fd, void **buf, size_t *size);
...
@@ -32,12 +31,6 @@ void fd_full_read(int fd, void **buf, size_t *size);
void
full_read
(
const
char
*
filename
,
void
**
buf
,
size_t
*
size
);
void
full_read
(
const
char
*
filename
,
void
**
buf
,
size_t
*
size
);
void
write_zero
(
int
fd
,
size_t
size
);
void
write_zero
(
int
fd
,
size_t
size
);
#ifdef __cplusplus
}
#include <functional>
#include <string_view>
void
file_readline
(
const
char
*
file
,
const
std
::
function
<
bool
(
std
::
string_view
)
>
&
fn
,
bool
trim
=
false
);
void
file_readline
(
const
char
*
file
,
const
std
::
function
<
bool
(
std
::
string_view
)
>
&
fn
,
bool
trim
=
false
);
void
parse_prop_file
(
const
char
*
file
,
const
std
::
function
void
parse_prop_file
(
const
char
*
file
,
const
std
::
function
<
bool
(
std
::
string_view
,
std
::
string_view
)
>
&
fn
);
<
bool
(
std
::
string_view
,
std
::
string_view
)
>
&
fn
);
...
@@ -81,5 +74,3 @@ void mmap_rw(const char *filename, B &buf, L &sz) {
...
@@ -81,5 +74,3 @@ void mmap_rw(const char *filename, B &buf, L &sz) {
buf
=
(
B
)
__mmap
(
filename
,
&
__sz
,
true
);
buf
=
(
B
)
__mmap
(
filename
,
&
__sz
,
true
);
sz
=
__sz
;
sz
=
__sz
;
}
}
#endif
\ No newline at end of file
native/jni/utils/include/logging.h
View file @
9aff1a57
/* logging.h - Error handling and logging
*/
#pragma once
#pragma once
#include <errno.h>
#include <errno.h>
#include <stdarg.h>
#include <stdarg.h>
#include <string.h>
#include <string.h>
#ifdef __cplusplus
__BEGIN_DECLS
extern
"C"
{
#endif
typedef
enum
{
typedef
enum
{
L_DEBUG
,
L_DEBUG
,
...
@@ -43,6 +38,4 @@ void cmdline_logging();
...
@@ -43,6 +38,4 @@ void cmdline_logging();
int
log_handler
(
log_type
t
,
const
char
*
fmt
,
...);
int
log_handler
(
log_type
t
,
const
char
*
fmt
,
...);
#ifdef __cplusplus
__END_DECLS
}
#endif
native/jni/utils/include/selinux.h
View file @
9aff1a57
...
@@ -18,8 +18,6 @@
...
@@ -18,8 +18,6 @@
#define SEPOL_PROC_DOMAIN "magisk"
#define SEPOL_PROC_DOMAIN "magisk"
#define SEPOL_FILE_DOMAIN "magisk_file"
#define SEPOL_FILE_DOMAIN "magisk_file"
__BEGIN_DECLS
extern
void
(
*
freecon
)(
char
*
con
);
extern
void
(
*
freecon
)(
char
*
con
);
extern
int
(
*
setcon
)(
const
char
*
con
);
extern
int
(
*
setcon
)(
const
char
*
con
);
extern
int
(
*
getfilecon
)(
const
char
*
path
,
char
**
con
);
extern
int
(
*
getfilecon
)(
const
char
*
path
,
char
**
con
);
...
@@ -35,5 +33,3 @@ void selinux_builtin_impl();
...
@@ -35,5 +33,3 @@ void selinux_builtin_impl();
void
dload_selinux
();
void
dload_selinux
();
void
restorecon
();
void
restorecon
();
void
restore_rootcon
();
void
restore_rootcon
();
__END_DECLS
native/jni/utils/misc.h
View file @
9aff1a57
#pragma once
#pragma once
#define UID_ROOT 0
#define UID_SHELL 2000
#ifdef __cplusplus
extern
"C"
{
#endif
int
fork_dont_care
();
int
fork_no_zombie
();
int
strend
(
const
char
*
s1
,
const
char
*
s2
);
char
*
rtrim
(
char
*
str
);
void
init_argv0
(
int
argc
,
char
**
argv
);
void
set_nice_name
(
const
char
*
name
);
int
parse_int
(
const
char
*
s
);
uint32_t
binary_gcd
(
uint32_t
u
,
uint32_t
v
);
int
switch_mnt_ns
(
int
pid
);
#ifdef __cplusplus
}
#include <string>
#include <string>
#include <functional>
#include <functional>
#include <string_view>
#include <string_view>
void
gen_rand_str
(
char
*
buf
,
int
len
,
bool
varlen
=
true
);
#define UID_ROOT 0
#define UID_SHELL 2000
#define str_contains(s, ss) ((ss) != nullptr && (s).find(ss) != std::string::npos)
#define str_contains(s, ss) ((ss) != nullptr && (s).find(ss) != std::string::npos)
#define str_starts(s, ss) ((ss) != nullptr && (s).compare(0, strlen(ss), ss) == 0)
#define str_starts(s, ss) ((ss) != nullptr && (s).compare(0, strlen(ss), ss) == 0)
...
@@ -78,8 +59,8 @@ reversed_container<T> reversed(T &base) {
...
@@ -78,8 +59,8 @@ reversed_container<T> reversed(T &base) {
return
reversed_container
<
T
>
(
base
);
return
reversed_container
<
T
>
(
base
);
}
}
int
parse_int
(
const
char
*
s
);
static
inline
int
parse_int
(
std
::
string
s
)
{
return
parse_int
(
s
.
data
());
}
static
inline
int
parse_int
(
std
::
string
s
)
{
return
parse_int
(
s
.
data
());
}
static
inline
int
parse_int
(
std
::
string_view
s
)
{
return
parse_int
(
s
.
data
());
}
static
inline
int
parse_int
(
std
::
string_view
s
)
{
return
parse_int
(
s
.
data
());
}
int
new_daemon_thread
(
void
*
(
*
start_routine
)
(
void
*
),
void
*
arg
=
nullptr
,
int
new_daemon_thread
(
void
*
(
*
start_routine
)
(
void
*
),
void
*
arg
=
nullptr
,
...
@@ -115,5 +96,12 @@ int exec_command_sync(Args &&...args) {
...
@@ -115,5 +96,12 @@ int exec_command_sync(Args &&...args) {
}
}
bool
ends_with
(
const
std
::
string_view
&
s1
,
const
std
::
string_view
&
s2
);
bool
ends_with
(
const
std
::
string_view
&
s1
,
const
std
::
string_view
&
s2
);
int
fork_dont_care
();
#endif
int
fork_no_zombie
();
int
strend
(
const
char
*
s1
,
const
char
*
s2
);
char
*
rtrim
(
char
*
str
);
void
init_argv0
(
int
argc
,
char
**
argv
);
void
set_nice_name
(
const
char
*
name
);
uint32_t
binary_gcd
(
uint32_t
u
,
uint32_t
v
);
int
switch_mnt_ns
(
int
pid
);
void
gen_rand_str
(
char
*
buf
,
int
len
,
bool
varlen
=
true
);
native/jni/utils/missing.h
View file @
9aff1a57
...
@@ -19,8 +19,6 @@
...
@@ -19,8 +19,6 @@
#define endmntent __endmntent
#define endmntent __endmntent
#define hasmntopt __hasmntopt
#define hasmntopt __hasmntopt
__BEGIN_DECLS
ssize_t
__getline
(
char
**
lineptr
,
size_t
*
n
,
FILE
*
stream
);
ssize_t
__getline
(
char
**
lineptr
,
size_t
*
n
,
FILE
*
stream
);
ssize_t
__getdelim
(
char
**
lineptr
,
size_t
*
n
,
int
delim
,
FILE
*
stream
);
ssize_t
__getdelim
(
char
**
lineptr
,
size_t
*
n
,
int
delim
,
FILE
*
stream
);
struct
mntent
*
__getmntent_r
(
FILE
*
fp
,
struct
mntent
*
e
,
char
*
buf
,
int
buf_len
);
struct
mntent
*
__getmntent_r
(
FILE
*
fp
,
struct
mntent
*
e
,
char
*
buf
,
int
buf_len
);
...
@@ -60,5 +58,3 @@ static inline int __linkat(int olddirfd, const char *oldpath,
...
@@ -60,5 +58,3 @@ static inline int __linkat(int olddirfd, const char *oldpath,
static
inline
int
__inotify_init1
(
int
flags
)
{
static
inline
int
__inotify_init1
(
int
flags
)
{
return
syscall
(
__NR_inotify_init1
,
flags
);
return
syscall
(
__NR_inotify_init1
,
flags
);
}
}
__END_DECLS
native/jni/utils/xwrap.h
View file @
9aff1a57
#pragma once
#pragma once
#ifdef __cplusplus
extern
"C"
{
#endif
FILE
*
xfopen
(
const
char
*
pathname
,
const
char
*
mode
);
FILE
*
xfopen
(
const
char
*
pathname
,
const
char
*
mode
);
FILE
*
xfdopen
(
int
fd
,
const
char
*
mode
);
FILE
*
xfdopen
(
int
fd
,
const
char
*
mode
);
int
xopen
(
const
char
*
pathname
,
int
flags
);
int
xopen
(
const
char
*
pathname
,
int
flags
,
mode_t
mode
);
int
xopenat
(
int
dirfd
,
const
char
*
pathname
,
int
flags
);
int
xopenat
(
int
dirfd
,
const
char
*
pathname
,
int
flags
);
ssize_t
xwrite
(
int
fd
,
const
void
*
buf
,
size_t
count
);
ssize_t
xwrite
(
int
fd
,
const
void
*
buf
,
size_t
count
);
ssize_t
xread
(
int
fd
,
void
*
buf
,
size_t
count
);
ssize_t
xread
(
int
fd
,
void
*
buf
,
size_t
count
);
...
@@ -22,9 +20,9 @@ int xbind(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
...
@@ -22,9 +20,9 @@ int xbind(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
int
xconnect
(
int
sockfd
,
const
struct
sockaddr
*
addr
,
socklen_t
addrlen
);
int
xconnect
(
int
sockfd
,
const
struct
sockaddr
*
addr
,
socklen_t
addrlen
);
int
xlisten
(
int
sockfd
,
int
backlog
);
int
xlisten
(
int
sockfd
,
int
backlog
);
int
xaccept4
(
int
sockfd
,
struct
sockaddr
*
addr
,
socklen_t
*
addrlen
,
int
flags
);
int
xaccept4
(
int
sockfd
,
struct
sockaddr
*
addr
,
socklen_t
*
addrlen
,
int
flags
);
void
*
xmalloc
(
size_t
size
);
extern
"C"
void
*
xmalloc
(
size_t
size
);
void
*
xcalloc
(
size_t
nmemb
,
size_t
size
);
extern
"C"
void
*
xcalloc
(
size_t
nmemb
,
size_t
size
);
void
*
xrealloc
(
void
*
ptr
,
size_t
size
);
extern
"C"
void
*
xrealloc
(
void
*
ptr
,
size_t
size
);
ssize_t
xsendmsg
(
int
sockfd
,
const
struct
msghdr
*
msg
,
int
flags
);
ssize_t
xsendmsg
(
int
sockfd
,
const
struct
msghdr
*
msg
,
int
flags
);
ssize_t
xrecvmsg
(
int
sockfd
,
struct
msghdr
*
msg
,
int
flags
);
ssize_t
xrecvmsg
(
int
sockfd
,
struct
msghdr
*
msg
,
int
flags
);
int
xpthread_create
(
pthread_t
*
thread
,
const
pthread_attr_t
*
attr
,
int
xpthread_create
(
pthread_t
*
thread
,
const
pthread_attr_t
*
attr
,
...
@@ -54,11 +52,3 @@ pid_t xfork();
...
@@ -54,11 +52,3 @@ pid_t xfork();
int
xpoll
(
struct
pollfd
*
fds
,
nfds_t
nfds
,
int
timeout
);
int
xpoll
(
struct
pollfd
*
fds
,
nfds_t
nfds
,
int
timeout
);
int
xinotify_init1
(
int
flags
);
int
xinotify_init1
(
int
flags
);
#ifdef __cplusplus
}
int
xopen
(
const
char
*
pathname
,
int
flags
);
int
xopen
(
const
char
*
pathname
,
int
flags
,
mode_t
mode
);
#endif
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