what does typedef __u16 __bitwise __le16; mean in Linux kernel?
i found that (source) and that
Type Identifiers
The following type identifiers correspond to the u16, u32, and u64 types, except they are defined with the bitwise attribute, which is used to restrict their use as integers. The bitwise attribute is used by the sparse utility to make sure the variable is converted to the local processor type before other (unsafe) operations are performed on the variable.
The following types can be used for endian dependent variables after including the linux/kernel.h header file.
__le16
__le32
__le64
__be16
__be32
__be64
difference between __u8 and uint8_t
uintn_t
are typedefs specified* by C99 (in <stdint.h>
) and C++11 (in <cstdint>
) standards. All new compilers provide these and appopriate definition is easy to get for the few ancient ones easily, so for portability always use this.
__un
are Linux-specific typedefs predating those standards. They are not portable. The double underscore is used to signify a non-standard definition.
* For 8, 16, 32 and 64 they shall be defined if the compiler has a type of that size, additional ones may be defined.
typedef void(* something)(someclass* something) - what does that mean? Never seen typedef usage like this
This is a function pointer. Variables of this type point to a function whose signature is void (GpsLocation*)
:
void foo(GpsLocation *);
gps_location_callback f = foo;
// now use f(p) etc
Without the typedef you'd have to write:
void (*f)(GpsLocation *) = foo;
What is isra in the kernel thread dump
isra
is the suffix added to the function name whengcc
option-fipa-sra
compiler optimization being carried out.
From gcc manual:
-fipa-sra
Perform interprocedural scalar replacement of aggregates, removal of unused
parameters and replacement of parameters passed by reference by parameters passed
by value.Enabled at levels
-O2
,-O3
and-Os
.
All functions that are optimized under this option have isra
appended to their names. I digged into gcc
code and found out the function that was appending the string.
tree
clone_function_name (tree decl, const char *suffix)
{
tree name = DECL_ASSEMBLER_NAME (decl);
size_t len = IDENTIFIER_LENGTH (name);
char *tmp_name, *prefix;
prefix = XALLOCAVEC (char, len + strlen (suffix) + 2);
memcpy (prefix, IDENTIFIER_POINTER (name), len);
strcpy (prefix + len + 1, suffix);
#ifndef NO_DOT_IN_LABEL
prefix[len] = '.';
#elif !defined NO_DOLLAR_IN_LABEL
prefix[len] = '$';
#else
prefix[len] = '_';
#endif
ASM_FORMAT_PRIVATE_NAME (tmp_name, prefix, clone_fn_id_num++);
return get_identifier (tmp_name);
}
Here, argument 2, const char *suffix
, is "isra"
and notice at the bottom of the function macro ASM_FORMAT_PRIVATE_NAME
which takes clone_fn_id_num++
as its 3rd argument. This is the arbitrary number found after "isra"
. This going by its name is the count of functions that are cloned under this compiler option (or may be a global counter that keeps track of all cloned functions).
If you want to understand more, search for modify_function
in file gcc/tree-sra.c
which in turn calls cgraph_function_versioning()
which passes "isra"
as its last argument.
Related Topics
Can't Install Freetds via Yum Package Manager
Converting Avi Frames to Jpgs on Linux
Erlang: Unix Domain Socket Support
Open O_Creat | O_Excl on Nfs in Linux
How Does Ancillary Data in Sendmsg() Work
Critical Timing in an Arm Linux Kernel Driver
Accessing Linux /Dev/Usb as Standard Files to Communicate with Usb Device
Extract Date from a File Name in Unix Using Shell Scripting
Redirect Process Stdin and Stdout to Netcat
Shell Script Password Security of Command-Line Parameters
How to Run an Opengl Application Installed on a Linux MAChine from My Windows MAChine
Where Do You Download Linux Source Code
How to Create a Hex Dump of File Containing Only the Hex Characters Without Spaces in Bash