Gcc compilation-general Linux technology-Linux technology and application information. For details, refer to the following section. This code is obtained from the Internet. The function is to obtain the mask of the current process. It uses the capget function to obtain the capability mask of the specified process. You can also use capset to set the mask. However, I tried to debug it based on what I mentioned in the paper. Through gcc, there were no successes and many errors were reported.
# Undef _ POSIX_SOURCE
# Include
# Include
# Include
# Include
# Include
# Include
Int main ()
{
Struct _ user_cap_header_struct cap_header_data;
Cap_user_header_t cap_header = & cap_header_data;
Struct _ user_cap_data_struct cap_data_data;
Cap_user_data_t cap_data = & cap_data_data;
Cap_header-> pid = getpid ();
Cap_header-> version = _ LINUX_CAPABILITY_VERSION_1;
If (capget (cap_header, cap_data) <0 ){
Perror ("Failed capget ");
Exit (1 );
}
Printf ("Cap data 0x % x, 0x % x, 0x % x \ n", cap_data-> valid tive,
Cap_data-> permitted, cap_data-> inheritable );
}
Error:
[Root @ localhost] # gcc-g new. c-o new
New. c: In function 'main ':
New. c: 11: 1: error: stray '\ 302' in program
New. c: 11: 1: error: stray '\ 240' in program
New. c: 11: 1: error: stray '\ 302' in program
New. c: 11: 1: error: stray '\ 240' in program
New. c: 11: 1: error: stray '\ 302' in program
.......
(The same error from line 11 to the end)
What's error about 302 & 240 ??
This is the case from row 11th to the end.
I don't know what the 240 and 302 errors are.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service