Driver Basics¶
Driver Entry and Exit points¶
- module_init¶
module_init(x)
driver initialization entry point
Parameters
xfunction to be run at kernel boot time or module insertion
Description
module_init() will either be called duringdo_initcalls() (ifbuiltin) or at module insertion time (if a module). There can onlybe one per module.
- module_exit¶
module_exit(x)
driver exit entry point
Parameters
xfunction to be run when driver is removed
Description
module_exit() will wrap the driver clean-up codewithcleanup_module() when used with rmmod whenthe driver is a module. If the driver is staticallycompiled into the kernel,module_exit() has no effect.There can only be one per module.
- structklp_modinfo¶
ELF information preserved from the livepatch module
Definition:
struct klp_modinfo { Elf_Ehdr hdr; Elf_Shdr *sechdrs; char *secstrings; unsigned int symndx;};Members
hdrELF header
sechdrsSection header table
secstringsString table for the section headers
symndxThe symbol table section index
Parameters
structmodule*modulethe module we should check for
Description
Only try to get a module reference count if the module is not being removed.This call will fail if the module is in the process of being removed.
Care must also be taken to ensure the module exists and is alive prior tousage of this call. This can be gauranteed through two means:
Direct protection: you know an earlier caller must have increased themodule reference through
__module_get(). This can typically be achievedby having another entity other than the module itself increment themodule reference count.Implied protection: there is an implied protection against moduleremoval. An example of this is the implied protection used by kernfs /sysfs. The sysfs store / read file operations are guaranteed to existthrough the use of kernfs’s active reference (see
kernfs_active()) and asysfs / kernfs file removal cannot happen unless the same file is notactive. Therefore, if a sysfs file is being read or written to the modulewhich created it must still exist. It is therefore safe to usetry_module_get()on module sysfs store / read ops.
One of the real values totry_module_get() is themodule_is_live() checkwhich ensures that the caller oftry_module_get() can yield to userspacemodule removal requests and gracefully fail if the module is on its way out.
Returns true if the reference count was successfully incremented.
Parameters
structmodule*modulethe module we should release a reference count for
Description
If you successfully bump a reference count to a module withtry_module_get(),when you are finished you must callmodule_put() to release that referencecount.
Driver device table¶
- structusb_device_id¶
identifies USB devices for probing and hotplugging
Definition:
struct usb_device_id { __u16 match_flags; __u16 idVendor; __u16 idProduct; __u16 bcdDevice_lo; __u16 bcdDevice_hi; __u8 bDeviceClass; __u8 bDeviceSubClass; __u8 bDeviceProtocol; __u8 bInterfaceClass; __u8 bInterfaceSubClass; __u8 bInterfaceProtocol; __u8 bInterfaceNumber; kernel_ulong_t driver_info ;};Members
match_flagsBit mask controlling which of the other fields are used tomatch against new devices. Any field except for driver_info may beused, although some only make sense in conjunction with other fields.This is usually set by a USB_DEVICE_*() macro, which sets allother fields in this structure except for driver_info.
idVendorUSB vendor ID for a device; numbers are assignedby the USB forum to its members.
idProductVendor-assigned product ID.
bcdDevice_loLow end of range of vendor-assigned product version numbers.This is also used to identify individual product versions, fora range consisting of a single device.
bcdDevice_hiHigh end of version number range. The range of productversions is inclusive.
bDeviceClassClass of device; numbers are assignedby the USB forum. Products may choose to implement classes,or be vendor-specific. Device classes specify behavior of allthe interfaces on a device.
bDeviceSubClassSubclass of device; associated with bDeviceClass.
bDeviceProtocolProtocol of device; associated with bDeviceClass.
bInterfaceClassClass of interface; numbers are assignedby the USB forum. Products may choose to implement classes,or be vendor-specific. Interface classes specify behavior onlyof a given interface; other interfaces may support other classes.
bInterfaceSubClassSubclass of interface; associated with bInterfaceClass.
bInterfaceProtocolProtocol of interface; associated with bInterfaceClass.
bInterfaceNumberNumber of interface; composite devices may usefixed interface numbers to differentiate between vendor-specificinterfaces.
driver_infoHolds information used by the driver. Usually it holdsa pointer to a descriptor understood by the driver, or perhapsdevice flags.
Description
In most cases, drivers will create a table of device IDs by usingUSB_DEVICE(), or similar macros designed for that purpose.They will then export it to userspace usingMODULE_DEVICE_TABLE(),and provide it to the USB core through their usb_driver structure.
See theusb_match_id() function for information about how matches areperformed. Briefly, you will normally use one of several macros to helpconstruct these entries. Each entry you provide will either identifyone or more specific products, or will identify a class of productswhich have agreed to behave the same. You should put the more specificmatches towards the beginning of your table, so that driver_info canrecord quirks of specific products.
- ACPI_DEVICE_CLASS¶
ACPI_DEVICE_CLASS(_cls,_msk)
macro used to describe an ACPI device with the PCI-defined class-code information
Parameters
_clsthe class, subclass, prog-if triple for this device
_mskthe class mask for this device
Description
This macro is used to create astructacpi_device_id that matches aspecific PCI class. The .id and .driver_data fields will be leftinitialized with the default value.
- structmdio_device_id¶
identifies PHY devices on an MDIO/MII bus
Definition:
struct mdio_device_id { __u32 phy_id; __u32 phy_id_mask;};Members
phy_idThe result of(mdio_read(
MII_PHYSID1) << 16 | mdio_read(MII_PHYSID2)) &phy_id_maskfor this PHY typephy_id_maskDefines the significant bits ofphy_id. A value of 0is used to terminate an array of
structmdio_device_id.
- structamba_id¶
identifies a device on an AMBA bus
Definition:
struct amba_id { unsigned int id; unsigned int mask; void *data;};Members
idThe significant bits if the hardware device ID
maskBitmask specifying which bits of the id field are significant whenmatching. A driver binds to a device when ((hardware device ID) & mask)== id.
dataPrivate data used by the driver.
- structmips_cdmm_device_id¶
identifies devices in MIPS CDMM bus
Definition:
struct mips_cdmm_device_id { __u8 type;};Members
typeDevice type identifier.
- structmei_cl_device_id¶
MEI client device identifier
Definition:
struct mei_cl_device_id { char name[MEI_CL_NAME_SIZE]; uuid_le uuid; __u8 version; kernel_ulong_t driver_info;};Members
namehelper name
uuidclient uuid
versionclient protocol version
driver_infoinformation used by the driver.
Description
identifies mei client device by uuid and name
- structrio_device_id¶
RIO device identifier
Definition:
struct rio_device_id { __u16 did, vid; __u16 asm_did, asm_vid;};Members
didRapidIO device ID
vidRapidIO vendor ID
asm_didRapidIO assembly device ID
asm_vidRapidIO assembly vendor ID
Description
Identifies a RapidIO device based on both the device/vendor IDs andthe assembly device/vendor IDs.
- structfsl_mc_device_id¶
MC object device identifier
Definition:
struct fsl_mc_device_id { __u16 vendor; const char obj_type[16];};Members
vendorvendor ID
obj_typeMC object type
Description
Type of entries in the “device Id” table for MC object devices supported bya MC object device driver. The last entry of the table has vendor set to 0x0
- structtb_service_id¶
Thunderbolt service identifiers
Definition:
struct tb_service_id { __u32 match_flags; char protocol_key[8 + 1]; __u32 protocol_id; __u32 protocol_version; __u32 protocol_revision; kernel_ulong_t driver_data;};Members
match_flagsFlags used to match the structure
protocol_keyProtocol key the service supports
protocol_idProtocol id the service supports
protocol_versionVersion of the protocol
protocol_revisionRevision of the protocol software
driver_dataDriver specific data
Description
Thunderbolt XDomain services are exposed as devices where each devicecarries the protocol information the service supports. ThunderboltXDomain service drivers match against that information.
- structtypec_device_id¶
USB Type-C alternate mode identifiers
Definition:
struct typec_device_id { __u16 svid; __u8 mode; kernel_ulong_t driver_data;};Members
svidStandard or Vendor ID
modeMode index
driver_dataDriver specific data
- structtee_client_device_id¶
tee based device identifier
Definition:
struct tee_client_device_id { uuid_t uuid;};Members
uuidFor TEE based client devices we use the device uuid asthe identifier.
- structwmi_device_id¶
WMI device identifier
Definition:
struct wmi_device_id { const char guid_string[UUID_STRING_LEN+1]; const void *context;};Members
guid_string36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba
contextpointer to driver specific data
- structmhi_device_id¶
MHI device identification
Definition:
struct mhi_device_id { const char chan[MHI_NAME_SIZE]; kernel_ulong_t driver_data;};Members
chanMHI channel name
driver_datadriver data;
- structdfl_device_id¶
dfl device identifier
Definition:
struct dfl_device_id { __u16 type; __u16 feature_id; kernel_ulong_t driver_data;};Members
typeDFL FIU type of the device. See
enumdfl_id_type.feature_idfeature identifier local to its DFL FIU type.
driver_datadriver specific data.
- structishtp_device_id¶
ISHTP device identifier
Definition:
struct ishtp_device_id { guid_t guid; kernel_ulong_t driver_data;};Members
guidGUID of the device.
driver_datapointer to driver specific data
- structcdx_device_id¶
CDX device identifier
Definition:
struct cdx_device_id { __u16 vendor; __u16 device; __u16 subvendor; __u16 subdevice; __u32 class; __u32 class_mask; __u32 override_only;};Members
vendorVendor ID
deviceDevice ID
subvendorSubsystem vendor ID (or CDX_ANY_ID)
subdeviceSubsystem device ID (or CDX_ANY_ID)
classDevice classMost drivers do not need to specify class/class_maskas vendor/device is normally sufficient.
class_maskLimit which sub-fields of the class field are compared.
override_onlyMatch only when dev->driver_override is this driver.
Description
Type of entries in the “device Id” table for CDX devices supported bya CDX device driver.
- structcoreboot_device_id¶
Identifies a coreboot table entry
Definition:
struct coreboot_device_id { __u32 tag; kernel_ulong_t driver_data;};Members
tagtag ID
driver_datadriver specific data
Delaying and scheduling routines¶
- structprev_cputime¶
snapshot of system and user cputime
Definition:
struct prev_cputime {#ifndef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE; u64 utime; u64 stime; raw_spinlock_t lock;#endif;};Members
utimetime spent in user mode
stimetime spent in system mode
lockprotects the above two fields
Description
Stores previous user/system time values such that we can guaranteemonotonicity.
- intset_cpus_allowed_ptr(structtask_struct*p,conststructcpumask*new_mask)¶
set CPU affinity mask of a task
Parameters
structtask_struct*pthe task
conststructcpumask*new_maskCPU affinity mask
Return
zero if successful, or a negative error code
- inttask_nice(conststructtask_struct*p)¶
return the nice value of a given task.
Parameters
conststructtask_struct*pthe task in question.
Return
The nice value [ -20 ... 0 ... 19 ].
- boolis_idle_task(conststructtask_struct*p)¶
is the specified task an idle task?
Parameters
conststructtask_struct*pthe task in question.
Return
1 ifp is an idle task. 0 otherwise.
- intwake_up_process(structtask_struct*p)¶
Wake up a specific process
Parameters
structtask_struct*pThe process to be woken up.
Description
Attempt to wake up the nominated process and move it to the set of runnableprocesses.
This function executes a full memory barrier before accessing the task state.
Return
1 if the process was woken up, 0 if it was already running.
- voidpreempt_notifier_register(structpreempt_notifier*notifier)¶
tell me when current is being preempted & rescheduled
Parameters
structpreempt_notifier*notifiernotifier
structtoregister
- voidpreempt_notifier_unregister(structpreempt_notifier*notifier)¶
no longer interested in preemption notifications
Parameters
structpreempt_notifier*notifiernotifier
structtounregister
Description
This isnot safe to call from within a preemption notifier.
- __visiblevoidnotracepreempt_schedule_notrace(void)¶
preempt_schedule called by tracing
Parameters
voidno arguments
Description
The tracing infrastructure uses preempt_enable_notrace to preventrecursion and tracing preempt enabling caused by the tracinginfrastructure itself. But as tracing can happen in areas comingfrom userspace or just about to enter userspace, a preempt enablecan occur beforeuser_exit() is called. This will cause the schedulerto be called when the system is still in usermode.
To prevent this, the preempt_enable_notrace will use this functioninstead ofpreempt_schedule() to exit user context if needed beforecalling the scheduler.
- intcpupri_find_fitness(structcpupri*cp,structtask_struct*p,structcpumask*lowest_mask,bool(*fitness_fn)(structtask_struct*p,intcpu))¶
find the best (lowest-pri) CPU in the system
Parameters
structcpupri*cpThe cpupri context
structtask_struct*pThe task
structcpumask*lowest_maskA mask to fill in with selected CPUs (or NULL)
bool(*fitness_fn)(structtask_struct*p,intcpu)A pointer to a function to do custom checks whether the CPUfits a specific criteria so that we only return those CPUs.
Note
This function returns the recommended CPUs as calculated during thecurrent invocation. By the time the call returns, the CPUs may have infact changed priorities any number of times. While not ideal, it is notan issue of correctness since the normal rebalancer logic will correctany discrepancies created by racing against the uncertainty of the currentpriority configuration.
Return
(int)bool - CPUs were found
- voidcpupri_set(structcpupri*cp,intcpu,intnewpri)¶
update the CPU priority setting
Parameters
structcpupri*cpThe cpupri context
intcpuThe target CPU
intnewpriThe priority (INVALID,NORMAL,RT1-RT99,HIGHER) to assign to this CPU
Note
Assumes cpu_rq(cpu)->lock is locked
Return
(void)
- intcpupri_init(structcpupri*cp)¶
initialize the cpupri structure
Parameters
structcpupri*cpThe cpupri context
Return
-ENOMEM on memory allocation failure.
- voidcpupri_cleanup(structcpupri*cp)¶
clean up the cpupri structure
Parameters
structcpupri*cpThe cpupri context
Parameters
structcfs_rq*cfs_rqthe cfs_rq whose avg changed
Description
This function ‘ensures’: tg->load_avg := Sum tg->cfs_rq[]->avg.load.However, because tg->load_avg is a global value there are performanceconsiderations.
In order to avoid having to look at the other cfs_rq’s, we use adifferential update where we store the last value we propagated. This inturn allows skipping updates if the differential is ‘small’.
Updating tg’s load_avg is necessary beforeupdate_cfs_share().
Parameters
u64nowcurrent time, as per
cfs_rq_clock_pelt()structcfs_rq*cfs_rqcfs_rq to update
Description
The cfs_rq avg is the direct sum of all its entities (blocked and runnable)avg. The immediate corollary is that all (fair) tasks must be attached.
cfs_rq->avg is used fortask_h_load() andupdate_cfs_share() for example.
Since both these conditions indicate a changed cfs_rq->avg.load we shouldcallupdate_tg_load_avg() when this function returns true.
Return
true if the load decayed or we removed load.
- voidattach_entity_load_avg(structcfs_rq*cfs_rq,structsched_entity*se)¶
attach this entity to its cfs_rq load avg
Parameters
structcfs_rq*cfs_rqcfs_rq to attach to
structsched_entity*sesched_entity to attach
Description
Must callupdate_cfs_rq_load_avg() before this, since we rely oncfs_rq->avg.last_update_time being current.
- voiddetach_entity_load_avg(structcfs_rq*cfs_rq,structsched_entity*se)¶
detach this entity from its cfs_rq load avg
Parameters
structcfs_rq*cfs_rqcfs_rq to detach from
structsched_entity*sesched_entity to detach
Description
Must callupdate_cfs_rq_load_avg() before this, since we rely oncfs_rq->avg.last_update_time being current.
- unsignedlongcpu_util(intcpu,structtask_struct*p,intdst_cpu,intboost)¶
Estimates the amount of CPU capacity used by CFS tasks.
Parameters
intcputhe CPU to get the utilization for
structtask_struct*ptask for which the CPU utilization should be predicted or NULL
intdst_cpuCPUp migrates to, -1 ifp moves fromcpu orp == NULL
intboost1 to enable boosting, otherwise 0
Description
The unit of the return value must be the same as the one of CPU capacityso that CPU utilization can be compared with CPU capacity.
CPU utilization is the sum of running time of runnable tasks plus therecent utilization of currently non-runnable tasks on that CPU.It represents the amount of CPU capacity currently used by CFS tasks inthe range [0..max CPU capacity] with max CPU capacity being the CPUcapacity at f_max.
The estimated CPU utilization is defined as the maximum between CPUutilization and sum of the estimated utilization of the currentlyrunnable tasks on that CPU. It preserves a utilization “snapshot” ofpreviously-executed tasks, which helps better deduce how busy a CPU willbe when a long-sleeping task wakes up. The contribution to CPU utilizationof such a task would be significantly decayed at this point of time.
Boosted CPU utilization is defined as max(CPU runnable, CPU utilization).CPU contention for CFS tasks can be detected by CPU runnable > CPUutilization. Boosting is implemented incpu_util() so that internalusers (e.g. EAS) can use it next to external users (e.g. schedutil),latter viacpu_util_cfs_boost().
CPU utilization can be higher than the current CPU capacity(f_curr/f_max * max CPU capacity) or even the max CPU capacity becauseof rounding errors as well as task migrations or wakeups of new tasks.CPU utilization has to be capped to fit into the [0..max CPU capacity]range. Otherwise a group of CPUs (CPU0 util = 121% + CPU1 util = 80%)could be seen as over-utilized even though CPU1 has 20% of spare CPUcapacity. CPU utilization is allowed to overshoot current CPU capacitythough since this is useful for predicting the CPU capacity requiredafter task migrations (scheduler-driven DVFS).
Return
(Boosted) (estimated) utilization for the specified CPU.
- boolsched_use_asym_prio(structsched_domain*sd,intcpu)¶
Check whether asym_packing priority must be used
Parameters
structsched_domain*sdThe scheduling domain of the load balancing
intcpuA CPU
Description
Always use CPU priority when balancing load between SMT siblings. Whenbalancing load between cores, it is not sufficient thatcpu is idle. Onlyuse CPU priority if the whole core is idle.
Return
True if the priority ofcpu must be followed. False otherwise.
- boolsched_group_asym(structlb_env*env,structsg_lb_stats*sgs,structsched_group*group)¶
Check if the destination CPU can do asym_packing balance
Parameters
structlb_env*envThe load balancing environment
structsg_lb_stats*sgsLoad-balancing statistics of the candidate busiest group
structsched_group*groupThe candidate busiest group
Description
env::dst_cpu can do asym_packing if it has higher priority than thepreferred CPU ofgroup.
Return
true ifenv::dst_cpu can do with asym_packing load balance. Falseotherwise.
- voidupdate_sg_lb_stats(structlb_env*env,structsd_lb_stats*sds,structsched_group*group,structsg_lb_stats*sgs,bool*sg_overloaded,bool*sg_overutilized)¶
Update sched_group’s statistics for load balancing.
Parameters
structlb_env*envThe load balancing environment.
structsd_lb_stats*sdsLoad-balancing data with statistics of the local group.
structsched_group*groupsched_group whose statistics are to be updated.
structsg_lb_stats*sgsvariable to hold the statistics for this group.
bool*sg_overloadedsched_group is overloaded
bool*sg_overutilizedsched_group is overutilized
- boolupdate_sd_pick_busiest(structlb_env*env,structsd_lb_stats*sds,structsched_group*sg,structsg_lb_stats*sgs)¶
return 1 on busiest group
Parameters
structlb_env*envThe load balancing environment.
structsd_lb_stats*sdssched_domain statistics
structsched_group*sgsched_group candidate to be checked for being the busiest
structsg_lb_stats*sgssched_group statistics
Description
Determine ifsg is a busier group than the previously selectedbusiest group.
Return
true ifsg is a busier group than the previously selectedbusiest group.false otherwise.
- intidle_cpu_without(intcpu,structtask_struct*p)¶
would a given CPU be idle without p ?
Parameters
intcputhe processor on which idleness is tested.
structtask_struct*ptask which should be ignored.
Return
1 if the CPU would be idle. 0 otherwise.
- voidupdate_sd_lb_stats(structlb_env*env,structsd_lb_stats*sds)¶
Update sched_domain’s statistics for load balancing.
Parameters
structlb_env*envThe load balancing environment.
structsd_lb_stats*sdsvariable to hold the statistics for this sched_domain.
- voidcalculate_imbalance(structlb_env*env,structsd_lb_stats*sds)¶
Calculate the amount of imbalance present within the groups of a given sched_domain during load balance.
Parameters
structlb_env*envload balance environment
structsd_lb_stats*sdsstatistics of the sched_domain whose imbalance is to be calculated.
- structsched_group*sched_balance_find_src_group(structlb_env*env)¶
Returns the busiest group within the sched_domain if there is an imbalance.
Parameters
structlb_env*envThe load balancing environment.
Description
Also calculates the amount of runnable load which should be movedto restore balance.
Return
The busiest group if imbalance exists.
- DECLARE_COMPLETION¶
DECLARE_COMPLETION(work)
declare and initialize a completion structure
Parameters
workidentifier for the completion structure
Description
This macro declares and initializes a completion structure. Generally usedfor static declarations. You should use the _ONSTACK variant for automaticvariables.
- DECLARE_COMPLETION_ONSTACK¶
DECLARE_COMPLETION_ONSTACK(work)
declare and initialize a completion structure
Parameters
workidentifier for the completion structure
Description
This macro declares and initializes a completion structure on the kernelstack.
- voidinit_completion(structcompletion*x)¶
Initialize a dynamically allocated completion
Parameters
structcompletion*xpointer to completion structure that is to be initialized
Description
This inline function will initialize a dynamically created completionstructure.
- voidreinit_completion(structcompletion*x)¶
reinitialize a completion structure
Parameters
structcompletion*xpointer to completion structure that is to be reinitialized
Description
This inline function should be used to reinitialize a completion structure so it canbe reused. This is especially important aftercomplete_all() is used.
Time and timer routines¶
- u64get_jiffies_64(void)¶
read the 64-bit non-atomic jiffies_64 value
Parameters
voidno arguments
Description
When BITS_PER_LONG < 64, this uses sequence number sampling usingjiffies_lock to protect the 64-bit read.
Return
current 64-bit jiffies value
- time_after¶
time_after(a,b)
returns true if the time a is after time b.
Parameters
afirst comparable as unsigned long
bsecond comparable as unsigned long
Description
Do this with “<0” and “>=0” to only test the sign of the result. Agood compiler would generate better code (and a really good compilerwouldn’t care). Gcc is currently neither.
Return
true is time a is after time b, otherwisefalse.
- time_before¶
time_before(a,b)
returns true if the time a is before time b.
Parameters
afirst comparable as unsigned long
bsecond comparable as unsigned long
Return
true is time a is before time b, otherwisefalse.
- time_after_eq¶
time_after_eq(a,b)
returns true if the time a is after or the same as time b.
Parameters
afirst comparable as unsigned long
bsecond comparable as unsigned long
Return
true is time a is after or the same as time b, otherwisefalse.
- time_before_eq¶
time_before_eq(a,b)
returns true if the time a is before or the same as time b.
Parameters
afirst comparable as unsigned long
bsecond comparable as unsigned long
Return
true is time a is before or the same as time b, otherwisefalse.
- time_in_range¶
time_in_range(a,b,c)
Calculate whether a is in the range of [b, c].
Parameters
atime to test
bbeginning of the range
cend of the range
Return
true is time a is in the range [b, c], otherwisefalse.
- time_in_range_open¶
time_in_range_open(a,b,c)
Calculate whether a is in the range of [b, c).
Parameters
atime to test
bbeginning of the range
cend of the range
Return
true is time a is in the range [b, c), otherwisefalse.
- time_after64¶
time_after64(a,b)
returns true if the time a is after time b.
Parameters
afirst comparable as __u64
bsecond comparable as __u64
Description
This must be used when utilizing jiffies_64 (i.e. return value ofget_jiffies_64()).
Return
true is time a is after time b, otherwisefalse.
- time_before64¶
time_before64(a,b)
returns true if the time a is before time b.
Parameters
afirst comparable as __u64
bsecond comparable as __u64
Description
This must be used when utilizing jiffies_64 (i.e. return value ofget_jiffies_64()).
Return
true is time a is before time b, otherwisefalse.
- time_after_eq64¶
time_after_eq64(a,b)
returns true if the time a is after or the same as time b.
Parameters
afirst comparable as __u64
bsecond comparable as __u64
Description
This must be used when utilizing jiffies_64 (i.e. return value ofget_jiffies_64()).
Return
true is time a is after or the same as time b, otherwisefalse.
- time_before_eq64¶
time_before_eq64(a,b)
returns true if the time a is before or the same as time b.
Parameters
afirst comparable as __u64
bsecond comparable as __u64
Description
This must be used when utilizing jiffies_64 (i.e. return value ofget_jiffies_64()).
Return
true is time a is before or the same as time b, otherwisefalse.
- time_in_range64¶
time_in_range64(a,b,c)
Calculate whether a is in the range of [b, c].
Parameters
atime to test
bbeginning of the range
cend of the range
Return
true is time a is in the range [b, c], otherwisefalse.
- time_is_before_jiffies¶
time_is_before_jiffies(a)
return true if a is before jiffies
Parameters
atime (unsigned long) to compare to jiffies
Return
true is time a is before jiffies, otherwisefalse.
- time_is_before_jiffies64¶
time_is_before_jiffies64(a)
return true if a is before jiffies_64
Parameters
atime (__u64) to compare to jiffies_64
Return
true is time a is before jiffies_64, otherwisefalse.
- time_is_after_jiffies¶
time_is_after_jiffies(a)
return true if a is after jiffies
Parameters
atime (unsigned long) to compare to jiffies
Return
true is time a is after jiffies, otherwisefalse.
- time_is_after_jiffies64¶
time_is_after_jiffies64(a)
return true if a is after jiffies_64
Parameters
atime (__u64) to compare to jiffies_64
Return
true is time a is after jiffies_64, otherwisefalse.
- time_is_before_eq_jiffies¶
time_is_before_eq_jiffies(a)
return true if a is before or equal to jiffies
Parameters
atime (unsigned long) to compare to jiffies
Return
true is time a is before or the same as jiffies, otherwisefalse.
- time_is_before_eq_jiffies64¶
time_is_before_eq_jiffies64(a)
return true if a is before or equal to jiffies_64
Parameters
atime (__u64) to compare to jiffies_64
Return
true is time a is before or the same jiffies_64, otherwisefalse.
- time_is_after_eq_jiffies¶
time_is_after_eq_jiffies(a)
return true if a is after or equal to jiffies
Parameters
atime (unsigned long) to compare to jiffies
Return
true is time a is after or the same as jiffies, otherwisefalse.
- time_is_after_eq_jiffies64¶
time_is_after_eq_jiffies64(a)
return true if a is after or equal to jiffies_64
Parameters
atime (__u64) to compare to jiffies_64
Return
true is time a is after or the same as jiffies_64, otherwisefalse.
- u64jiffies_to_nsecs(constunsignedlongj)¶
Convert jiffies to nanoseconds
Parameters
constunsignedlongjjiffies value
Return
nanoseconds value
- unsignedlongmsecs_to_jiffies(constunsignedintm)¶
convert milliseconds to jiffies
Parameters
constunsignedintmtime in milliseconds
Description
conversion is done as follows:
negative values mean ‘infinite timeout’ (MAX_JIFFY_OFFSET)
‘too large’ values [that would result in larger thanMAX_JIFFY_OFFSET values] mean ‘infinite timeout’ too.
all other values are converted to jiffies by either multiplyingthe input value by a factor or dividing it with a factor andhandling any 32-bit overflows.for the details see
_msecs_to_jiffies()
msecs_to_jiffies() checks for the passed in value being a constantvia__builtin_constant_p() allowing gcc to eliminate most of thecode.__msecs_to_jiffies() is called if the value passed does notallow constant folding and the actual conversion must be done atruntime.The HZ range specific helpers_msecs_to_jiffies() are called bothdirectly here and from__msecs_to_jiffies() in the case whereconstant folding is not possible.
Return
jiffies value
- secs_to_jiffies¶
secs_to_jiffies(_secs)
convert seconds to jiffies
Parameters
_secstime in seconds
Description
Conversion is done by simple multiplication with HZ
secs_to_jiffies() is defined as a macro rather than a static inlinefunction so it can be used in static initializers.
Return
jiffies value
- unsignedlongusecs_to_jiffies(constunsignedintu)¶
convert microseconds to jiffies
Parameters
constunsignedintutime in microseconds
Description
conversion is done as follows:
‘too large’ values [that would result in larger thanMAX_JIFFY_OFFSET values] mean ‘infinite timeout’ too.
all other values are converted to jiffies by either multiplyingthe input value by a factor or dividing it with a factor andhandling any 32-bit overflows as for msecs_to_jiffies.
usecs_to_jiffies() checks for the passed in value being a constantvia__builtin_constant_p() allowing gcc to eliminate most of thecode.__usecs_to_jiffies() is called if the value passed does notallow constant folding and the actual conversion must be done atruntime.The HZ range specific helpers_usecs_to_jiffies() are called bothdirectly here and from__msecs_to_jiffies() in the case whereconstant folding is not possible.
Return
jiffies value
- unsignedintjiffies_to_msecs(constunsignedlongj)¶
Convert jiffies to milliseconds
Parameters
constunsignedlongjjiffies value
Description
Avoid unnecessary multiplications/divisions in thetwo most common HZ cases.
Return
milliseconds value
- unsignedintjiffies_to_usecs(constunsignedlongj)¶
Convert jiffies to microseconds
Parameters
constunsignedlongjjiffies value
Return
microseconds value
- time64_tmktime64(constunsignedintyear0,constunsignedintmon0,constunsignedintday,constunsignedinthour,constunsignedintmin,constunsignedintsec)¶
Converts date to seconds.
Parameters
constunsignedintyear0year to convert
constunsignedintmon0month to convert
constunsignedintdayday to convert
constunsignedinthourhour to convert
constunsignedintminminute to convert
constunsignedintsecsecond to convert
Description
Converts Gregorian date to seconds since 1970-01-01 00:00:00.Assumes input in normal date format, i.e. 1980-12-31 23:59:59=> year=1980, mon=12, day=31, hour=23, min=59, sec=59.
[For the Julian calendar (which was used in Russia before 1917,Britain & colonies before 1752, anywhere else before 1582,and is still in use by some communities) leave out the-year/100+year/400 terms, and add 10.]
This algorithm was first published by Gauss (I think).
A leap second can be indicated by calling this function with sec as60 (allowable under ISO 8601). The leap second is treated the sameas the following second since they don’t exist in UNIX time.
An encoding of midnight at the end of the day as 24:00:00 - ie. midnighttomorrow - (allowable under ISO 8601) is supported.
Return
seconds since the epoch time for the given input date
- voidset_normalized_timespec64(structtimespec64*ts,time64_tsec,s64nsec)¶
set timespec sec and nsec parts and normalize
Parameters
structtimespec64*tspointer to timespec variable to be set
time64_tsecseconds to set
s64nsecnanoseconds to set
Description
Set seconds and nanoseconds field of a timespec variable andnormalize to the timespec storage format
Note
The tv_nsec part is always in the range of 0 <= tv_nsec < NSEC_PER_SEC.For negative values only the tv_sec field is negative !
- structtimespec64ns_to_timespec64(s64nsec)¶
Convert nanoseconds to timespec64
Parameters
s64nsecthe nanoseconds value to be converted
Return
the timespec64 representation of the nsec parameter.
- unsignedlong__msecs_to_jiffies(constunsignedintm)¶
convert milliseconds to jiffies
Parameters
constunsignedintmtime in milliseconds
Description
conversion is done as follows:
negative values mean ‘infinite timeout’ (MAX_JIFFY_OFFSET)
‘too large’ values [that would result in larger thanMAX_JIFFY_OFFSET values] mean ‘infinite timeout’ too.
all other values are converted to jiffies by either multiplyingthe input value by a factor or dividing it with a factor andhandling any 32-bit overflows.for the details see
_msecs_to_jiffies()
msecs_to_jiffies() checks for the passed in value being a constantvia__builtin_constant_p() allowing gcc to eliminate most of thecode,__msecs_to_jiffies() is called if the value passed does notallow constant folding and the actual conversion must be done atruntime.The _msecs_to_jiffies helpers are the HZ dependent conversionroutines found in include/linux/jiffies.h
Return
jiffies value
- unsignedlong__usecs_to_jiffies(constunsignedintu)¶
convert microseconds to jiffies
Parameters
constunsignedintutime in milliseconds
Return
jiffies value
- unsignedlongtimespec64_to_jiffies(conststructtimespec64*value)¶
convert a timespec64 value to jiffies
Parameters
conststructtimespec64*valuepointer to
structtimespec64
Description
The TICK_NSEC - 1 rounds up the value to the next resolution. Notethat a remainder subtract here would not do the right thing as theresolution values don’t fall on second boundaries. I.e. the line:nsec -= nsec % TICK_NSEC; is NOT a correct resolution rounding.Note that due to the small error in the multiplier here, thisrounding is incorrect for sufficiently large values of tv_nsec, butwell formed timespecs should have tv_nsec < NSEC_PER_SEC, so we’reOK.
Rather, we just shift the bits off the right.
The >> (NSEC_JIFFIE_SC - SEC_JIFFIE_SC) converts the scaled nsecvalue to a scaled second value.
Return
jiffies value
- voidjiffies_to_timespec64(constunsignedlongjiffies,structtimespec64*value)¶
convert jiffies value to
structtimespec64
Parameters
constunsignedlongjiffiesjiffies value
structtimespec64*valuepointer to
structtimespec64
- clock_tjiffies_to_clock_t(unsignedlongx)¶
Convert jiffies to clock_t
Parameters
unsignedlongxjiffies value
Return
jiffies converted to clock_t (CLOCKS_PER_SEC)
- unsignedlongclock_t_to_jiffies(unsignedlongx)¶
Convert clock_t to jiffies
Parameters
unsignedlongxclock_t value
Return
clock_t value converted to jiffies
- u64jiffies_64_to_clock_t(u64x)¶
Convert jiffies_64 to clock_t
Parameters
u64xjiffies_64 value
Return
jiffies_64 value converted to 64-bit “clock_t” (CLOCKS_PER_SEC)
- u64jiffies64_to_nsecs(u64j)¶
Convert jiffies64 to nanoseconds
Parameters
u64jjiffies64 value
Return
nanoseconds value
- u64jiffies64_to_msecs(constu64j)¶
Convert jiffies64 to milliseconds
Parameters
constu64jjiffies64 value
Return
milliseconds value
- u64nsecs_to_jiffies64(u64n)¶
Convert nsecs in u64 to jiffies64
Parameters
u64nnsecs in u64
Description
Unlike {m,u}secs_to_jiffies, type of input is not unsigned int but u64.And this doesn’t return MAX_JIFFY_OFFSET since this function is designedfor scheduler, not for use in device drivers to calculate timeout value.
note
NSEC_PER_SEC = 10^9 = (5^9 * 2^9) = (1953125 * 512)ULLONG_MAX ns = 18446744073.709551615 secs = about 584 years
Return
nsecs converted to jiffies64 value
- unsignedlongnsecs_to_jiffies(u64n)¶
Convert nsecs in u64 to jiffies
Parameters
u64nnsecs in u64
Description
Unlike {m,u}secs_to_jiffies, type of input is not unsigned int but u64.And this doesn’t return MAX_JIFFY_OFFSET since this function is designedfor scheduler, not for use in device drivers to calculate timeout value.
note
NSEC_PER_SEC = 10^9 = (5^9 * 2^9) = (1953125 * 512)ULLONG_MAX ns = 18446744073.709551615 secs = about 584 years
Return
nsecs converted to jiffies value
- structtimespec64timespec64_add_safe(conststructtimespec64lhs,conststructtimespec64rhs)¶
Add two timespec64 values and do a safety check for overflow.
Parameters
conststructtimespec64lhsfirst (left) timespec64 to add
conststructtimespec64rhssecond (right) timespec64 to add
Description
It’s assumed that both values are valid (>= 0).And, each timespec64 is in normalized form.
Return
sum oflhs +rhs
- intget_timespec64(structtimespec64*ts,conststruct__kernel_timespec__user*uts)¶
get user’s time value into kernel space
Parameters
structtimespec64*tsdestination
structtimespec64conststruct__kernel_timespec__user*utsuser’s time value as
struct__kernel_timespec
Description
Handles compat or 32-bit modes.
Return
0 on success or negative errno on error
- intput_timespec64(conststructtimespec64*ts,struct__kernel_timespec__user*uts)¶
convert timespec64 value to __kernel_timespec format and copy the latter to userspace
Parameters
conststructtimespec64*tsinput
structtimespec64struct__kernel_timespec__user*utsuser’s
struct__kernel_timespec
Return
0 on success or negative errno on error
- intget_old_timespec32(structtimespec64*ts,constvoid__user*uts)¶
get user’s old-format time value into kernel space
Parameters
structtimespec64*tsdestination
structtimespec64constvoid__user*utsuser’s old-format time value (
structold_timespec32)
Description
Handles X86_X32_ABI compatibility conversion.
Return
0 on success or negative errno on error
- intput_old_timespec32(conststructtimespec64*ts,void__user*uts)¶
convert timespec64 value to
structold_timespec32and copy the latter to userspace
Parameters
conststructtimespec64*tsinput
structtimespec64void__user*utsuser’s
structold_timespec32
Description
Handles X86_X32_ABI compatibility conversion.
Return
0 on success or negative errno on error
- intget_itimerspec64(structitimerspec64*it,conststruct__kernel_itimerspec__user*uit)¶
get user’s
struct__kernel_itimerspecinto kernel space
Parameters
structitimerspec64*itdestination
structitimerspec64conststruct__kernel_itimerspec__user*uituser’s
struct__kernel_itimerspec
Return
0 on success or negative errno on error
- intput_itimerspec64(conststructitimerspec64*it,struct__kernel_itimerspec__user*uit)¶
convert
structitimerspec64to __kernel_itimerspec format and copy the latter to userspace
Parameters
conststructitimerspec64*itinput
structitimerspec64struct__kernel_itimerspec__user*uituser’s
struct__kernel_itimerspec
Return
0 on success or negative errno on error
- intget_old_itimerspec32(structitimerspec64*its,conststructold_itimerspec32__user*uits)¶
get user’s
structold_itimerspec32into kernel space
Parameters
structitimerspec64*itsdestination
structitimerspec64conststructold_itimerspec32__user*uitsuser’s
structold_itimerspec32
Return
0 on success or negative errno on error
- intput_old_itimerspec32(conststructitimerspec64*its,structold_itimerspec32__user*uits)¶
convert
structitimerspec64tostructold_itimerspec32and copy the latter to userspace
Parameters
conststructitimerspec64*itsinput
structitimerspec64structold_itimerspec32__user*uitsuser’s
structold_itimerspec32
Return
0 on success or negative errno on error
- unsignedlong__round_jiffies_relative(unsignedlongj,intcpu)¶
function to round jiffies to a full second
Parameters
unsignedlongjthe time in (relative) jiffies that should be rounded
intcputhe processor number on which the timeout will happen
Description
__round_jiffies_relative() rounds a time delta in the future (in jiffies)up or down to (approximately) full seconds. This is useful for timersfor which the exact time they fire does not matter too much, as long asthey fire approximately every X seconds.
By rounding these timers to whole seconds, all such timers will fireat the same time, rather than at various times spread out. The goalof this is to have the CPU wake up less, which saves power.
The exact rounding is skewed for each processor to avoid allprocessors firing at the exact same time, which could leadto lock contention or spurious cache line bouncing.
The return value is the rounded version of thej parameter.
- unsignedlonground_jiffies(unsignedlongj)¶
function to round jiffies to a full second
Parameters
unsignedlongjthe time in (absolute) jiffies that should be rounded
Description
round_jiffies() rounds an absolute time in the future (in jiffies)up or down to (approximately) full seconds. This is useful for timersfor which the exact time they fire does not matter too much, as long asthey fire approximately every X seconds.
By rounding these timers to whole seconds, all such timers will fireat the same time, rather than at various times spread out. The goalof this is to have the CPU wake up less, which saves power.
The return value is the rounded version of thej parameter.
- unsignedlonground_jiffies_relative(unsignedlongj)¶
function to round jiffies to a full second
Parameters
unsignedlongjthe time in (relative) jiffies that should be rounded
Description
round_jiffies_relative() rounds a time delta in the future (in jiffies)up or down to (approximately) full seconds. This is useful for timersfor which the exact time they fire does not matter too much, as long asthey fire approximately every X seconds.
By rounding these timers to whole seconds, all such timers will fireat the same time, rather than at various times spread out. The goalof this is to have the CPU wake up less, which saves power.
The return value is the rounded version of thej parameter.
- unsignedlong__round_jiffies_up_relative(unsignedlongj,intcpu)¶
function to round jiffies up to a full second
Parameters
unsignedlongjthe time in (relative) jiffies that should be rounded
intcputhe processor number on which the timeout will happen
Description
This is the same as__round_jiffies_relative() except that it will neverround down. This is useful for timeouts for which the exact timeof firing does not matter too much, as long as they don’t fire tooearly.
- unsignedlonground_jiffies_up(unsignedlongj)¶
function to round jiffies up to a full second
Parameters
unsignedlongjthe time in (absolute) jiffies that should be rounded
Description
This is the same asround_jiffies() except that it will neverround down. This is useful for timeouts for which the exact timeof firing does not matter too much, as long as they don’t fire tooearly.
- unsignedlonground_jiffies_up_relative(unsignedlongj)¶
function to round jiffies up to a full second
Parameters
unsignedlongjthe time in (relative) jiffies that should be rounded
Description
This is the same asround_jiffies_relative() except that it will neverround down. This is useful for timeouts for which the exact timeof firing does not matter too much, as long as they don’t fire tooearly.
- voidtimer_init_key(structtimer_list*timer,void(*func)(structtimer_list*),unsignedintflags,constchar*name,structlock_class_key*key)¶
initialize a timer
Parameters
structtimer_list*timerthe timer to be initialized
void(*func)(structtimer_list*)timer callback function
unsignedintflagstimer flags
constchar*namename of the timer
structlock_class_key*keylockdep class key of the fake lock used for tracking timersync lock dependencies
Description
timer_init_key() must be done to a timer prior to callingany of theother timer functions.
- intmod_timer_pending(structtimer_list*timer,unsignedlongexpires)¶
Modify a pending timer’s timeout
Parameters
structtimer_list*timerThe pending timer to be modified
unsignedlongexpiresNew absolute timeout in jiffies
Description
mod_timer_pending() is the same for pending timers asmod_timer(), butwill not activate inactive timers.
Iftimer->function == NULL then the start operation is silentlydiscarded.
Return
0- The timer was inactive and not modified or was inshutdown state and the operation was discarded
1- The timer was active and requeued to expire atexpires
- intmod_timer(structtimer_list*timer,unsignedlongexpires)¶
Modify a timer’s timeout
Parameters
structtimer_list*timerThe timer to be modified
unsignedlongexpiresNew absolute timeout in jiffies
Description
mod_timer(timer, expires) is equivalent to:
timer_delete(timer); timer->expires = expires; add_timer(timer);
mod_timer() is more efficient than the above open coded sequence. Incase that the timer is inactive, thetimer_delete() part is a NOP. Thetimer is in any case activated with the new expiry timeexpires.
Note that if there are multiple unserialized concurrent users of thesame timer, thenmod_timer() is the only safe way to modify the timeout,sinceadd_timer() cannot modify an already running timer.
Iftimer->function == NULL then the start operation is silentlydiscarded. In this case the return value is 0 and meaningless.
Return
0- The timer was inactive and started or was in shutdownstate and the operation was discarded
1- The timer was active and requeued to expire atexpires orthe timer was active and not modified becauseexpires didnot change the effective expiry time
- inttimer_reduce(structtimer_list*timer,unsignedlongexpires)¶
Modify a timer’s timeout if it would reduce the timeout
Parameters
structtimer_list*timerThe timer to be modified
unsignedlongexpiresNew absolute timeout in jiffies
Description
timer_reduce() is very similar tomod_timer(), except that it will onlymodify an enqueued timer if that would reduce the expiration time. Iftimer is not enqueued it starts the timer.
Iftimer->function == NULL then the start operation is silentlydiscarded.
Return
0- The timer was inactive and started or was in shutdownstate and the operation was discarded
1- The timer was active and requeued to expire atexpires orthe timer was active and not modified becauseexpiresdid not change the effective expiry time such that thetimer would expire earlier than already scheduled
- voidadd_timer(structtimer_list*timer)¶
Start a timer
Parameters
structtimer_list*timerThe timer to be started
Description
Starttimer to expire attimer->expires in the future.timer->expiresis the absolute expiry time measured in ‘jiffies’. When the timer expirestimer->function(timer) will be invoked from soft interrupt context.
Thetimer->expires andtimer->function fields must be set priorto calling this function.
Iftimer->function == NULL then the start operation is silentlydiscarded.
Iftimer->expires is already in the pasttimer will be queued toexpire at the next timer tick.
This can only operate on an inactive timer. Attempts to invoke this onan active timer are rejected with a warning.
- voidadd_timer_local(structtimer_list*timer)¶
Start a timer on the local CPU
Parameters
structtimer_list*timerThe timer to be started
Description
Same asadd_timer() except that the timer flag TIMER_PINNED is set.
Seeadd_timer() for further details.
- voidadd_timer_global(structtimer_list*timer)¶
Start a timer without TIMER_PINNED flag set
Parameters
structtimer_list*timerThe timer to be started
Description
Same asadd_timer() except that the timer flag TIMER_PINNED is unset.
Seeadd_timer() for further details.
- voidadd_timer_on(structtimer_list*timer,intcpu)¶
Start a timer on a particular CPU
Parameters
structtimer_list*timerThe timer to be started
intcpuThe CPU to start it on
Description
Same asadd_timer() except that it starts the timer on the given CPU andthe TIMER_PINNED flag is set. When timer shouldn’t be a pinned timer inthe next round,add_timer_global() should be used instead as it unsetsthe TIMER_PINNED flag.
Seeadd_timer() for further details.
- inttimer_delete(structtimer_list*timer)¶
Deactivate a timer
Parameters
structtimer_list*timerThe timer to be deactivated
Description
The function only deactivates a pending timer, but contrary totimer_delete_sync() it does not take into account whether the timer’scallback function is concurrently executed on a different CPU or not.It neither prevents rearming of the timer. Iftimer can be rearmedconcurrently then the return value of this function is meaningless.
Return
0- The timer was not pending1- The timer was pending and deactivated
- inttimer_shutdown(structtimer_list*timer)¶
Deactivate a timer and prevent rearming
Parameters
structtimer_list*timerThe timer to be deactivated
Description
The function does not wait for an eventually running timer callback on adifferent CPU but it prevents rearming of the timer. Any attempt to armtimer after this function returns will be silently ignored.
This function is useful for teardown code and should only be used whentimer_shutdown_sync() cannot be invoked due to locking or context constraints.
Return
0- The timer was not pending1- The timer was pending
- inttimer_delete_sync_try(structtimer_list*timer)¶
Try to deactivate a timer
Parameters
structtimer_list*timerTimer to deactivate
Description
This function tries to deactivate a timer. On success the timer is notqueued and the timer callback function is not running on any CPU.
This function does not guarantee that the timer cannot be rearmed rightafter dropping the base lock. That needs to be prevented by the callingcode if necessary.
Return
0- The timer was not pending1- The timer was pending and deactivated-1- The timer callback function is running on a different CPU
- inttimer_delete_sync(structtimer_list*timer)¶
Deactivate a timer and wait for the handler to finish.
Parameters
structtimer_list*timerThe timer to be deactivated
Description
Synchronization rules: Callers must prevent restarting of the timer,otherwise this function is meaningless. It must not be called frominterrupt contexts unless the timer is an irqsafe one. The caller mustnot hold locks which would prevent completion of the timer’s callbackfunction. The timer’s handler must not calladd_timer_on(). Upon exitthe timer is not queued and the handler is not running on any CPU.
For !irqsafe timers, the caller must not hold locks that are held ininterrupt context. Even if the lock has nothing to do with the timer inquestion. Here’s why:
CPU0 CPU1---- ---- <SOFTIRQ> call_timer_fn(); base->running_timer = mytimer;spin_lock_irq(somelock); <IRQ> spin_lock(somelock);timer_delete_sync(mytimer);while (base->running_timer == mytimer);
Nowtimer_delete_sync() will never return and never release somelock.The interrupt on the other CPU is waiting to grab somelock but it hasinterrupted the softirq that CPU0 is waiting to finish.
This function cannot guarantee that the timer is not rearmed again bysome concurrent or preempting code, right after it dropped the baselock. If there is the possibility of a concurrent rearm then the returnvalue of the function is meaningless.
If such a guarantee is needed, e.g. for teardown situations then usetimer_shutdown_sync() instead.
Return
0- The timer was not pending1- The timer was pending and deactivated
- inttimer_shutdown_sync(structtimer_list*timer)¶
Shutdown a timer and prevent rearming
Parameters
structtimer_list*timerThe timer to be shutdown
Description
- When the function returns it is guaranteed that:
timer is not queued
The callback function oftimer is not running
timer cannot be enqueued again. Any attempt to rearmtimer is silently ignored.
Seetimer_delete_sync() for synchronization rules.
This function is useful for final teardown of an infrastructure wherethe timer is subject to a circular dependency problem.
A common pattern for this is a timer and a workqueue where the timer canschedule work and work can arm the timer. On shutdown the workqueue mustbe destroyed and the timer must be prevented from rearming. Unless thecode has conditionals like ‘if (mything->in_shutdown)’ to prevent thatthere is no way to get this correct withtimer_delete_sync().
timer_shutdown_sync() is solving the problem. The correct ordering ofcalls in this case is:
timer_shutdown_sync(
mything->timer);workqueue_destroy(mything->workqueue);
After this ‘mything’ can be safely freed.
This obviously implies that the timer is not required to be functionalfor the rest of the shutdown operation.
Return
0- The timer was not pending1- The timer was pending
High-resolution timers¶
- ktime_tktime_set(consts64secs,constunsignedlongnsecs)¶
Set a ktime_t variable from a seconds/nanoseconds value
Parameters
consts64secsseconds to set
constunsignedlongnsecsnanoseconds to set
Return
The ktime_t representation of the value.
- intktime_compare(constktime_tcmp1,constktime_tcmp2)¶
Compares two ktime_t variables for less, greater or equal
Parameters
constktime_tcmp1comparable1
constktime_tcmp2comparable2
Return
...cmp1 < cmp2: return <0cmp1 == cmp2: return 0cmp1 > cmp2: return >0
- boolktime_after(constktime_tcmp1,constktime_tcmp2)¶
Compare if a ktime_t value is bigger than another one.
Parameters
constktime_tcmp1comparable1
constktime_tcmp2comparable2
Return
true if cmp1 happened after cmp2.
- boolktime_before(constktime_tcmp1,constktime_tcmp2)¶
Compare if a ktime_t value is smaller than another one.
Parameters
constktime_tcmp1comparable1
constktime_tcmp2comparable2
Return
true if cmp1 happened before cmp2.
- boolktime_to_timespec64_cond(constktime_tkt,structtimespec64*ts)¶
convert a ktime_t variable to timespec64 format only if the variable contains data
Parameters
constktime_tktthe ktime_t variable to convert
structtimespec64*tsthe timespec variable to store the result in
Return
true if there was a successful conversion,false if kt was 0.
- structhrtimer_sleeper¶
simple sleeper structure
Definition:
struct hrtimer_sleeper { struct hrtimer timer; struct task_struct *task;};Members
timerembedded timer structure
tasktask to wake up
Description
task is set to NULL, when the timer expires.
- voidhrtimer_start(structhrtimer*timer,ktime_ttim,constenumhrtimer_modemode)¶
(re)start an hrtimer
Parameters
structhrtimer*timerthe timer to be added
ktime_ttimexpiry time
constenumhrtimer_modemodetimer mode: absolute (HRTIMER_MODE_ABS) orrelative (HRTIMER_MODE_REL), and pinned (HRTIMER_MODE_PINNED);softirq based mode is considered for debug purpose only!
- ktime_thrtimer_get_remaining(conststructhrtimer*timer)¶
get remaining time for the timer
Parameters
conststructhrtimer*timerthe timer to read
- boolhrtimer_is_queued(structhrtimer*timer)¶
check, whether the timer is on one of the queues
Parameters
structhrtimer*timerTimer to check
Return
True if the timer is queued, false otherwise
Description
The function can be used lockless, but it gives only a current snapshot.
- voidhrtimer_update_function(structhrtimer*timer,enumhrtimer_restart(*function)(structhrtimer*))¶
Update the timer’s callback function
Parameters
structhrtimer*timerTimer to update
enumhrtimer_restart(*function)(structhrtimer*)New callback function
Description
Only safe to call if the timer is not enqueued. Can be called in the callback function if thetimer is not enqueued at the same time (see the comments above HRTIMER_STATE_ENQUEUED).
- u64hrtimer_forward_now(structhrtimer*timer,ktime_tinterval)¶
forward the timer expiry so it expires after now
Parameters
structhrtimer*timerhrtimer to forward
ktime_tintervalthe interval to forward
Description
It is a variant ofhrtimer_forward(). The timer will expire after the currenttime of the hrtimer clock base. Seehrtimer_forward() for details.
- u64hrtimer_forward(structhrtimer*timer,ktime_tnow,ktime_tinterval)¶
forward the timer expiry
Parameters
structhrtimer*timerhrtimer to forward
ktime_tnowforward past this time
ktime_tintervalthe interval to forward
Description
Forward the timer expiry so it will expire in the future.
Note
This only updates the timer expiry value and does not requeue the timer.
There is also a variant of the functionhrtimer_forward_now().
Context
Can be safely called from the callback function oftimer. If calledfrom other contextstimer must neither be enqueued nor running thecallback and the caller needs to take care of serialization.
Return
The number of overruns are returned.
- voidhrtimer_start_range_ns(structhrtimer*timer,ktime_ttim,u64delta_ns,constenumhrtimer_modemode)¶
(re)start an hrtimer
Parameters
structhrtimer*timerthe timer to be added
ktime_ttimexpiry time
u64delta_ns“slack” range for the timer
constenumhrtimer_modemodetimer mode: absolute (HRTIMER_MODE_ABS) orrelative (HRTIMER_MODE_REL), and pinned (HRTIMER_MODE_PINNED);softirq based mode is considered for debug purpose only!
- inthrtimer_try_to_cancel(structhrtimer*timer)¶
try to deactivate a timer
Parameters
structhrtimer*timerhrtimer to stop
Description
0 when the timer was not active
1 when the timer was active
-1 when the timer is currently executing the callback function andcannot be stopped
- inthrtimer_cancel(structhrtimer*timer)¶
cancel a timer and wait for the handler to finish.
Parameters
structhrtimer*timerthe timer to be cancelled
Return
0 when the timer was not active1 when the timer was active
- ktime_t__hrtimer_get_remaining(conststructhrtimer*timer,booladjust)¶
get remaining time for the timer
Parameters
conststructhrtimer*timerthe timer to read
booladjustadjust relative timers when CONFIG_TIME_LOW_RES=y
- voidhrtimer_setup(structhrtimer*timer,enumhrtimer_restart(*function)(structhrtimer*),clockid_tclock_id,enumhrtimer_modemode)¶
initialize a timer to the given clock
Parameters
structhrtimer*timerthe timer to be initialized
enumhrtimer_restart(*function)(structhrtimer*)the callback function
clockid_tclock_idthe clock to be used
enumhrtimer_modemodeThe modes which are relevant for initialization:HRTIMER_MODE_ABS, HRTIMER_MODE_REL, HRTIMER_MODE_ABS_SOFT,HRTIMER_MODE_REL_SOFT
Description
The PINNED variants of the above can be handed in,but the PINNED bit is ignored as pinning happenswhen the hrtimer is started
- voidhrtimer_setup_on_stack(structhrtimer*timer,enumhrtimer_restart(*function)(structhrtimer*),clockid_tclock_id,enumhrtimer_modemode)¶
initialize a timer on stack memory
Parameters
structhrtimer*timerThe timer to be initialized
enumhrtimer_restart(*function)(structhrtimer*)the callback function
clockid_tclock_idThe clock to be used
enumhrtimer_modemodeThe timer mode
Description
Similar tohrtimer_setup(), except that this one must be used ifstructhrtimer is in stackmemory.
- voidhrtimer_sleeper_start_expires(structhrtimer_sleeper*sl,enumhrtimer_modemode)¶
Start a hrtimer sleeper timer
Parameters
structhrtimer_sleeper*slsleeper to be started
enumhrtimer_modemodetimer mode abs/rel
Description
Wrapper aroundhrtimer_start_expires() for hrtimer_sleeper based timersto allow PREEMPT_RT to tweak the delivery mode (soft/hardirq context)
- voidhrtimer_setup_sleeper_on_stack(structhrtimer_sleeper*sl,clockid_tclock_id,enumhrtimer_modemode)¶
initialize a sleeper in stack memory
Parameters
structhrtimer_sleeper*slsleeper to be initialized
clockid_tclock_idthe clock to be used
enumhrtimer_modemodetimer mode abs/rel
Wait queues and Wake events¶
- intwaitqueue_active(structwait_queue_head*wq_head)¶
locklessly test for waiters on the queue
Parameters
structwait_queue_head*wq_headthe waitqueue to test for waiters
Description
returns true if the wait list is not empty
NOTE
this function is lockless and requires care, incorrect usage _will_lead to sporadic and non-obvious failure.
Use either while holding wait_queue_head::lock or when used for wakeupswith an extrasmp_mb() like:
CPU0 - waker CPU1 - waiter for (;;) {@cond = true; prepare_to_wait(&wq_head, &wait, state);smp_mb(); // smp_mb() from set_current_state()if (waitqueue_active(wq_head)) if (@cond) wake_up(wq_head); break; schedule(); } finish_wait(&wq_head, &wait);Because without the explicitsmp_mb() it’s possible for thewaitqueue_active() load to get hoisted over thecond store such that we’llobserve an empty wait list while the waiter might not observecond.
Also note that this ‘optimization’ trades aspin_lock() for ansmp_mb(),which (when the lock is uncontended) are of roughly equal cost.
- boolwq_has_single_sleeper(structwait_queue_head*wq_head)¶
check if there is only one sleeper
Parameters
structwait_queue_head*wq_headwait queue head
Description
Returns true of wq_head has only one sleeper on the list.
Please refer to the comment for waitqueue_active.
- boolwq_has_sleeper(structwait_queue_head*wq_head)¶
check if there are any waiting processes
Parameters
structwait_queue_head*wq_headwait queue head
Description
Returns true if wq_head has waiting processes
Please refer to the comment for waitqueue_active.
- voidwake_up_pollfree(structwait_queue_head*wq_head)¶
signal that a polled waitqueue is going away
Parameters
structwait_queue_head*wq_headthe wait queue head
Description
In the very rare cases where a ->poll() implementation uses a waitqueue whoselifetime is tied to a task rather than to the ‘structfile’ being polled,this function must be called before the waitqueue is freed so thatnon-blocking polls (e.g. epoll) are notified that the queue is going away.
The caller must also RCU-delay the freeing of the wait_queue_head, e.g. viaan explicitsynchronize_rcu() orcall_rcu(), or via SLAB_TYPESAFE_BY_RCU.
- wait_event¶
wait_event(wq_head,condition)
sleep until a condition gets true
Parameters
wq_headthe waitqueue to wait on
conditiona C expression for the event to wait for
Description
The process is put to sleep (TASK_UNINTERRUPTIBLE) until thecondition evaluates to true. Thecondition is checked each timethe waitqueuewq_head is woken up.
wake_up() has to be called after changing any variable that couldchange the result of the wait condition.
- wait_event_freezable¶
wait_event_freezable(wq_head,condition)
sleep (or freeze) until a condition gets true
Parameters
wq_headthe waitqueue to wait on
conditiona C expression for the event to wait for
Description
The process is put to sleep (TASK_INTERRUPTIBLE -- so as not to contributeto system load) until thecondition evaluates to true. Thecondition is checked each time the waitqueuewq_head is woken up.
wake_up() has to be called after changing any variable that couldchange the result of the wait condition.
- wait_event_timeout¶
wait_event_timeout(wq_head,condition,timeout)
sleep until a condition gets true or a timeout elapses
Parameters
wq_headthe waitqueue to wait on
conditiona C expression for the event to wait for
timeouttimeout, in jiffies
Description
The process is put to sleep (TASK_UNINTERRUPTIBLE) until thecondition evaluates to true. Thecondition is checked each timethe waitqueuewq_head is woken up.
wake_up() has to be called after changing any variable that couldchange the result of the wait condition.
Return
0 if thecondition evaluated tofalse after thetimeout elapsed,1 if thecondition evaluated totrue after thetimeout elapsed,or the remaining jiffies (at least 1) if thecondition evaluatedtotrue before thetimeout elapsed.
- wait_event_cmd¶
wait_event_cmd(wq_head,condition,cmd1,cmd2)
sleep until a condition gets true
Parameters
wq_headthe waitqueue to wait on
conditiona C expression for the event to wait for
cmd1the command will be executed before sleep
cmd2the command will be executed after sleep
Description
The process is put to sleep (TASK_UNINTERRUPTIBLE) until thecondition evaluates to true. Thecondition is checked each timethe waitqueuewq_head is woken up.
wake_up() has to be called after changing any variable that couldchange the result of the wait condition.
- wait_event_interruptible¶
wait_event_interruptible(wq_head,condition)
sleep until a condition gets true
Parameters
wq_headthe waitqueue to wait on
conditiona C expression for the event to wait for
Description
The process is put to sleep (TASK_INTERRUPTIBLE) until thecondition evaluates to true or a signal is received.Thecondition is checked each time the waitqueuewq_head is woken up.
wake_up() has to be called after changing any variable that couldchange the result of the wait condition.
The function will return -ERESTARTSYS if it was interrupted by asignal and 0 ifcondition evaluated to true.
- wait_event_interruptible_timeout¶
wait_event_interruptible_timeout(wq_head,condition,timeout)
sleep until a condition gets true or a timeout elapses
Parameters
wq_headthe waitqueue to wait on
conditiona C expression for the event to wait for
timeouttimeout, in jiffies
Description
The process is put to sleep (TASK_INTERRUPTIBLE) until thecondition evaluates to true or a signal is received.Thecondition is checked each time the waitqueuewq_head is woken up.
wake_up() has to be called after changing any variable that couldchange the result of the wait condition.
Return
0 if thecondition evaluated tofalse after thetimeout elapsed,1 if thecondition evaluated totrue after thetimeout elapsed,the remaining jiffies (at least 1) if thecondition evaluatedtotrue before thetimeout elapsed, or -ERESTARTSYS if it wasinterrupted by a signal.
- wait_event_hrtimeout¶
wait_event_hrtimeout(wq_head,condition,timeout)
sleep until a condition gets true or a timeout elapses
Parameters
wq_headthe waitqueue to wait on
conditiona C expression for the event to wait for
timeouttimeout, as a ktime_t
Description
The process is put to sleep (TASK_UNINTERRUPTIBLE) until thecondition evaluates to true or a signal is received.Thecondition is checked each time the waitqueuewq_head is woken up.
wake_up() has to be called after changing any variable that couldchange the result of the wait condition.
The function returns 0 ifcondition became true, or -ETIME if the timeoutelapsed.
- wait_event_interruptible_hrtimeout¶
wait_event_interruptible_hrtimeout(wq,condition,timeout)
sleep until a condition gets true or a timeout elapses
Parameters
wqthe waitqueue to wait on
conditiona C expression for the event to wait for
timeouttimeout, as a ktime_t
Description
The process is put to sleep (TASK_INTERRUPTIBLE) until thecondition evaluates to true or a signal is received.Thecondition is checked each time the waitqueuewq is woken up.
wake_up() has to be called after changing any variable that couldchange the result of the wait condition.
The function returns 0 ifcondition became true, -ERESTARTSYS if it wasinterrupted by a signal, or -ETIME if the timeout elapsed.
- wait_event_idle¶
wait_event_idle(wq_head,condition)
wait for a condition without contributing to system load
Parameters
wq_headthe waitqueue to wait on
conditiona C expression for the event to wait for
Description
The process is put to sleep (TASK_IDLE) until thecondition evaluates to true.Thecondition is checked each time the waitqueuewq_head is woken up.
wake_up() has to be called after changing any variable that couldchange the result of the wait condition.
- wait_event_idle_exclusive¶
wait_event_idle_exclusive(wq_head,condition)
wait for a condition with contributing to system load
Parameters
wq_headthe waitqueue to wait on
conditiona C expression for the event to wait for
Description
The process is put to sleep (TASK_IDLE) until thecondition evaluates to true.Thecondition is checked each time the waitqueuewq_head is woken up.
The process is put on the wait queue with an WQ_FLAG_EXCLUSIVE flagset thus if other processes wait on the same list, when thisprocess is woken further processes are not considered.
wake_up() has to be called after changing any variable that couldchange the result of the wait condition.
- wait_event_idle_timeout¶
wait_event_idle_timeout(wq_head,condition,timeout)
sleep without load until a condition becomes true or a timeout elapses
Parameters
wq_headthe waitqueue to wait on
conditiona C expression for the event to wait for
timeouttimeout, in jiffies
Description
The process is put to sleep (TASK_IDLE) until thecondition evaluates to true. Thecondition is checked each timethe waitqueuewq_head is woken up.
wake_up() has to be called after changing any variable that couldchange the result of the wait condition.
Return
0 if thecondition evaluated tofalse after thetimeout elapsed,1 if thecondition evaluated totrue after thetimeout elapsed,or the remaining jiffies (at least 1) if thecondition evaluatedtotrue before thetimeout elapsed.
- wait_event_idle_exclusive_timeout¶
wait_event_idle_exclusive_timeout(wq_head,condition,timeout)
sleep without load until a condition becomes true or a timeout elapses
Parameters
wq_headthe waitqueue to wait on
conditiona C expression for the event to wait for
timeouttimeout, in jiffies
Description
The process is put to sleep (TASK_IDLE) until thecondition evaluates to true. Thecondition is checked each timethe waitqueuewq_head is woken up.
The process is put on the wait queue with an WQ_FLAG_EXCLUSIVE flagset thus if other processes wait on the same list, when thisprocess is woken further processes are not considered.
wake_up() has to be called after changing any variable that couldchange the result of the wait condition.
Return
0 if thecondition evaluated tofalse after thetimeout elapsed,1 if thecondition evaluated totrue after thetimeout elapsed,or the remaining jiffies (at least 1) if thecondition evaluatedtotrue before thetimeout elapsed.
- wait_event_interruptible_locked¶
wait_event_interruptible_locked(wq,condition)
sleep until a condition gets true
Parameters
wqthe waitqueue to wait on
conditiona C expression for the event to wait for
Description
The process is put to sleep (TASK_INTERRUPTIBLE) until thecondition evaluates to true or a signal is received.Thecondition is checked each time the waitqueuewq is woken up.
It must be called with wq.lock being held. This spinlock isunlocked while sleeping butcondition testing is done while lockis held and when this macro exits the lock is held.
The lock is locked/unlocked usingspin_lock()/spin_unlock()functions which must match the way they are locked/unlocked outsideof this macro.
wake_up_locked() has to be called after changing any variable that couldchange the result of the wait condition.
The function will return -ERESTARTSYS if it was interrupted by asignal and 0 ifcondition evaluated to true.
- wait_event_interruptible_locked_irq¶
wait_event_interruptible_locked_irq(wq,condition)
sleep until a condition gets true
Parameters
wqthe waitqueue to wait on
conditiona C expression for the event to wait for
Description
The process is put to sleep (TASK_INTERRUPTIBLE) until thecondition evaluates to true or a signal is received.Thecondition is checked each time the waitqueuewq is woken up.
It must be called with wq.lock being held. This spinlock isunlocked while sleeping butcondition testing is done while lockis held and when this macro exits the lock is held.
The lock is locked/unlocked usingspin_lock_irq()/spin_unlock_irq()functions which must match the way they are locked/unlocked outsideof this macro.
wake_up_locked() has to be called after changing any variable that couldchange the result of the wait condition.
The function will return -ERESTARTSYS if it was interrupted by asignal and 0 ifcondition evaluated to true.
- wait_event_interruptible_exclusive_locked¶
wait_event_interruptible_exclusive_locked(wq,condition)
sleep exclusively until a condition gets true
Parameters
wqthe waitqueue to wait on
conditiona C expression for the event to wait for
Description
The process is put to sleep (TASK_INTERRUPTIBLE) until thecondition evaluates to true or a signal is received.Thecondition is checked each time the waitqueuewq is woken up.
It must be called with wq.lock being held. This spinlock isunlocked while sleeping butcondition testing is done while lockis held and when this macro exits the lock is held.
The lock is locked/unlocked usingspin_lock()/spin_unlock()functions which must match the way they are locked/unlocked outsideof this macro.
The process is put on the wait queue with an WQ_FLAG_EXCLUSIVE flagset thus when other process waits process on the list if thisprocess is awaken further processes are not considered.
wake_up_locked() has to be called after changing any variable that couldchange the result of the wait condition.
The function will return -ERESTARTSYS if it was interrupted by asignal and 0 ifcondition evaluated to true.
- wait_event_interruptible_exclusive_locked_irq¶
wait_event_interruptible_exclusive_locked_irq(wq,condition)
sleep until a condition gets true
Parameters
wqthe waitqueue to wait on
conditiona C expression for the event to wait for
Description
The process is put to sleep (TASK_INTERRUPTIBLE) until thecondition evaluates to true or a signal is received.Thecondition is checked each time the waitqueuewq is woken up.
It must be called with wq.lock being held. This spinlock isunlocked while sleeping butcondition testing is done while lockis held and when this macro exits the lock is held.
The lock is locked/unlocked usingspin_lock_irq()/spin_unlock_irq()functions which must match the way they are locked/unlocked outsideof this macro.
The process is put on the wait queue with an WQ_FLAG_EXCLUSIVE flagset thus when other process waits process on the list if thisprocess is awaken further processes are not considered.
wake_up_locked() has to be called after changing any variable that couldchange the result of the wait condition.
The function will return -ERESTARTSYS if it was interrupted by asignal and 0 ifcondition evaluated to true.
- wait_event_killable¶
wait_event_killable(wq_head,condition)
sleep until a condition gets true
Parameters
wq_headthe waitqueue to wait on
conditiona C expression for the event to wait for
Description
The process is put to sleep (TASK_KILLABLE) until thecondition evaluates to true or a signal is received.Thecondition is checked each time the waitqueuewq_head is woken up.
wake_up() has to be called after changing any variable that couldchange the result of the wait condition.
The function will return -ERESTARTSYS if it was interrupted by asignal and 0 ifcondition evaluated to true.
- wait_event_state¶
wait_event_state(wq_head,condition,state)
sleep until a condition gets true
Parameters
wq_headthe waitqueue to wait on
conditiona C expression for the event to wait for
statestate to sleep in
Description
The process is put to sleep (state) until thecondition evaluates to trueor a signal is received (when allowed bystate). Thecondition is checkedeach time the waitqueuewq_head is woken up.
wake_up() has to be called after changing any variable that couldchange the result of the wait condition.
The function will return -ERESTARTSYS if it was interrupted by a signal(when allowed bystate) and 0 ifcondition evaluated to true.
- wait_event_killable_timeout¶
wait_event_killable_timeout(wq_head,condition,timeout)
sleep until a condition gets true or a timeout elapses
Parameters
wq_headthe waitqueue to wait on
conditiona C expression for the event to wait for
timeouttimeout, in jiffies
Description
The process is put to sleep (TASK_KILLABLE) until thecondition evaluates to true or a kill signal is received.Thecondition is checked each time the waitqueuewq_head is woken up.
wake_up() has to be called after changing any variable that couldchange the result of the wait condition.
Only kill signals interrupt this process.
Return
0 if thecondition evaluated tofalse after thetimeout elapsed,1 if thecondition evaluated totrue after thetimeout elapsed,the remaining jiffies (at least 1) if thecondition evaluatedtotrue before thetimeout elapsed, or -ERESTARTSYS if it wasinterrupted by a kill signal.
- wait_event_lock_irq_cmd¶
wait_event_lock_irq_cmd(wq_head,condition,lock,cmd)
sleep until a condition gets true. The condition is checked under the lock. This is expected to be called with the lock taken.
Parameters
wq_headthe waitqueue to wait on
conditiona C expression for the event to wait for
locka locked spinlock_t, which will be released before cmdand
schedule()and reacquired afterwards.cmda command which is invoked outside the critical section beforesleep
Description
The process is put to sleep (TASK_UNINTERRUPTIBLE) until thecondition evaluates to true. Thecondition is checked each timethe waitqueuewq_head is woken up.
wake_up() has to be called after changing any variable that couldchange the result of the wait condition.
This is supposed to be called while holding the lock. The lock isdropped before invoking the cmd and going to sleep and is reacquiredafterwards.
- wait_event_lock_irq¶
wait_event_lock_irq(wq_head,condition,lock)
sleep until a condition gets true. The condition is checked under the lock. This is expected to be called with the lock taken.
Parameters
wq_headthe waitqueue to wait on
conditiona C expression for the event to wait for
locka locked spinlock_t, which will be released before
schedule()and reacquired afterwards.
Description
The process is put to sleep (TASK_UNINTERRUPTIBLE) until thecondition evaluates to true. Thecondition is checked each timethe waitqueuewq_head is woken up.
wake_up() has to be called after changing any variable that couldchange the result of the wait condition.
This is supposed to be called while holding the lock. The lock isdropped before going to sleep and is reacquired afterwards.
- wait_event_interruptible_lock_irq_cmd¶
wait_event_interruptible_lock_irq_cmd(wq_head,condition,lock,cmd)
sleep until a condition gets true. The condition is checked under the lock. This is expected to be called with the lock taken.
Parameters
wq_headthe waitqueue to wait on
conditiona C expression for the event to wait for
locka locked spinlock_t, which will be released before cmd and
schedule()and reacquired afterwards.cmda command which is invoked outside the critical section beforesleep
Description
The process is put to sleep (TASK_INTERRUPTIBLE) until thecondition evaluates to true or a signal is received. Thecondition ischecked each time the waitqueuewq_head is woken up.
wake_up() has to be called after changing any variable that couldchange the result of the wait condition.
This is supposed to be called while holding the lock. The lock isdropped before invoking the cmd and going to sleep and is reacquiredafterwards.
The macro will return -ERESTARTSYS if it was interrupted by a signaland 0 ifcondition evaluated to true.
- wait_event_interruptible_lock_irq¶
wait_event_interruptible_lock_irq(wq_head,condition,lock)
sleep until a condition gets true. The condition is checked under the lock. This is expected to be called with the lock taken.
Parameters
wq_headthe waitqueue to wait on
conditiona C expression for the event to wait for
locka locked spinlock_t, which will be released before
schedule()and reacquired afterwards.
Description
The process is put to sleep (TASK_INTERRUPTIBLE) until thecondition evaluates to true or signal is received. Thecondition ischecked each time the waitqueuewq_head is woken up.
wake_up() has to be called after changing any variable that couldchange the result of the wait condition.
This is supposed to be called while holding the lock. The lock isdropped before going to sleep and is reacquired afterwards.
The macro will return -ERESTARTSYS if it was interrupted by a signaland 0 ifcondition evaluated to true.
- wait_event_interruptible_lock_irq_timeout¶
wait_event_interruptible_lock_irq_timeout(wq_head,condition,lock,timeout)
sleep until a condition gets true or a timeout elapses. The condition is checked under the lock. This is expected to be called with the lock taken.
Parameters
wq_headthe waitqueue to wait on
conditiona C expression for the event to wait for
locka locked spinlock_t, which will be released before
schedule()and reacquired afterwards.timeouttimeout, in jiffies
Description
The process is put to sleep (TASK_INTERRUPTIBLE) until thecondition evaluates to true or signal is received. Thecondition ischecked each time the waitqueuewq_head is woken up.
wake_up() has to be called after changing any variable that couldchange the result of the wait condition.
This is supposed to be called while holding the lock. The lock isdropped before going to sleep and is reacquired afterwards.
The function returns 0 if thetimeout elapsed, -ERESTARTSYS if itwas interrupted by a signal, and the remaining jiffies otherwiseif the condition evaluated to true before the timeout elapsed.
- int__wake_up(structwait_queue_head*wq_head,unsignedintmode,intnr_exclusive,void*key)¶
wake up threads blocked on a waitqueue.
Parameters
structwait_queue_head*wq_headthe waitqueue
unsignedintmodewhich threads
intnr_exclusivehow many wake-one or wake-many threads to wake up
void*keyis directly passed to the wakeup function
Description
If this function wakes up a task, it executes a full memory barrierbefore accessing the task state. Returns the number of exclusivetasks that were awaken.
- void__wake_up_sync_key(structwait_queue_head*wq_head,unsignedintmode,void*key)¶
wake up threads blocked on a waitqueue.
Parameters
structwait_queue_head*wq_headthe waitqueue
unsignedintmodewhich threads
void*keyopaque value to be passed to wakeup targets
Description
The sync wakeup differs that the waker knows that it will scheduleaway soon, so while the target thread will be woken up, it will notbe migrated to another CPU - ie. the two threads are ‘synchronized’with each other. This can prevent needless bouncing between CPUs.
On UP it can prevent extra preemption.
If this function wakes up a task, it executes a full memory barrier beforeaccessing the task state.
- void__wake_up_locked_sync_key(structwait_queue_head*wq_head,unsignedintmode,void*key)¶
wake up a thread blocked on a locked waitqueue.
Parameters
structwait_queue_head*wq_headthe waitqueue
unsignedintmodewhich threads
void*keyopaque value to be passed to wakeup targets
Description
The sync wakeup differs in that the waker knows that it will scheduleaway soon, so while the target thread will be woken up, it will notbe migrated to another CPU - ie. the two threads are ‘synchronized’with each other. This can prevent needless bouncing between CPUs.
On UP it can prevent extra preemption.
If this function wakes up a task, it executes a full memory barrier beforeaccessing the task state.
- voidfinish_wait(structwait_queue_head*wq_head,structwait_queue_entry*wq_entry)¶
clean up after waiting in a queue
Parameters
structwait_queue_head*wq_headwaitqueue waited on
structwait_queue_entry*wq_entrywait descriptor
Description
Sets current thread back to running state and removesthe wait descriptor from the given waitqueue if stillqueued.
Internal Functions¶
- intwait_task_stopped(structwait_opts*wo,intptrace,structtask_struct*p)¶
Wait for
TASK_STOPPEDorTASK_TRACED
Parameters
structwait_opts*wowait options
intptraceis the wait for ptrace
structtask_struct*ptask to wait for
Description
Handlesys_wait4() work forp in stateTASK_STOPPED orTASK_TRACED.
Context
read_lock(tasklist_lock), which is released if return value isnon-zero. Also, grabs and releasesp->sighand->siglock.
Return
0 if wait condition didn’t exist and search for other wait conditionsshould continue. Non-zero return, -errno on failure andp’s pid onsuccess, implies that tasklist_lock is released and wait conditionsearch should terminate.
- booltask_set_jobctl_pending(structtask_struct*task,unsignedlongmask)¶
set jobctl pending bits
Parameters
structtask_struct*tasktarget task
unsignedlongmaskpending bits to set
Description
Clearmask fromtask->jobctl.mask must be subset ofJOBCTL_PENDING_MASK |JOBCTL_STOP_CONSUME |JOBCTL_STOP_SIGMASK |JOBCTL_TRAPPING. If stop signo is being set, the existing signo iscleared. Iftask is already being killed or exiting, this functionbecomes noop.
Context
Must be called withtask->sighand->siglock held.
Return
true ifmask is set,false if made noop becausetask was dying.
- voidtask_clear_jobctl_trapping(structtask_struct*task)¶
clear jobctl trapping bit
Parameters
structtask_struct*tasktarget task
Description
If JOBCTL_TRAPPING is set, a ptracer is waiting for us to enter TRACED.Clear it and wake up the ptracer. Note that we don’t need any furtherlocking.task->siglock guarantees thattask->parent points to theptracer.
Context
Must be called withtask->sighand->siglock held.
- voidtask_clear_jobctl_pending(structtask_struct*task,unsignedlongmask)¶
clear jobctl pending bits
Parameters
structtask_struct*tasktarget task
unsignedlongmaskpending bits to clear
Description
Clearmask fromtask->jobctl.mask must be subset ofJOBCTL_PENDING_MASK. IfJOBCTL_STOP_PENDING is being cleared, otherSTOP bits are cleared together.
If clearing ofmask leaves no stop or trap pending, this function callstask_clear_jobctl_trapping().
Context
Must be called withtask->sighand->siglock held.
- booltask_participate_group_stop(structtask_struct*task)¶
participate in a group stop
Parameters
structtask_struct*tasktask participating in a group stop
Description
task hasJOBCTL_STOP_PENDING set and is participating in a group stop.Group stop states are cleared and the group stop count is consumed ifJOBCTL_STOP_CONSUME was set. If the consumption completes the groupstop, the appropriateSIGNAL_* flags are set.
Context
Must be called withtask->sighand->siglock held.
Return
true if group stop completion should be notified to the parent,falseotherwise.
- voidptrace_trap_notify(structtask_struct*t)¶
schedule trap to notify ptracer
Parameters
structtask_struct*ttracee wanting to notify tracer
Description
This function schedules sticky ptrace trap which is cleared on the nextTRAP_STOP to notify ptracer of an event.t must have been seized byptracer.
Ift is running, STOP trap will be taken. If trapped for STOP andptracer is listening for events, tracee is woken up so that it canre-trap for the new event. If trapped otherwise, STOP trap will beeventually taken without returning to userland after the existing trapsare finished by PTRACE_CONT.
Context
Must be called withtask->sighand->siglock held.
- intforce_sig_seccomp(intsyscall,intreason,boolforce_coredump)¶
signals the task to allow in-process syscall emulation
Parameters
intsyscallsyscall number to send to userland
intreasonfilter-supplied reason code to send to userland (via si_errno)
boolforce_coredumptrue to trigger a coredump
Description
Forces a SIGSYS with a code of SYS_SECCOMP and related sigsys info.
- voiddo_notify_parent_cldstop(structtask_struct*tsk,boolfor_ptracer,intwhy)¶
notify parent of stopped/continued state change
Parameters
structtask_struct*tsktask reporting the state change
boolfor_ptracerthe notification is for ptracer
intwhyCLD_{CONTINUED|STOPPED|TRAPPED} to report
Description
Notifytsk’s parent that the stopped/continued state has changed. Iffor_ptracer isfalse,tsk’s group leader notifies to its real parent.Iftrue,tsk reports totsk->parent which should be the ptracer.
Context
Must be called with tasklist_lock at least read locked.
- booldo_signal_stop(intsignr)¶
handle group stop for SIGSTOP and other stop signals
Parameters
intsignrsignr causing group stop if initiating
Description
IfJOBCTL_STOP_PENDING is not set yet, initiate group stop withsignrand participate in it. If already set, participate in the existinggroup stop. If participated in a group stop (and thus slept),true isreturned with siglock released.
If ptraced, this function doesn’t handle stop itself. Instead,JOBCTL_TRAP_STOP is scheduled andfalse is returned with siglockuntouched. The caller must ensure that INTERRUPT trap handling takesplaces afterwards.
Context
Must be called withcurrent->sighand->siglock held, which is releasedontrue return.
Return
false if group stop is already cancelled or ptrace trap is scheduled.true if participated in group stop.
- voiddo_jobctl_trap(void)¶
take care of ptrace jobctl traps
Parameters
voidno arguments
Description
When PT_SEIZED, it’s used for both group stop and explicitSEIZE/INTERRUPT traps. Both generate PTRACE_EVENT_STOP trap withaccompanying siginfo. If stopped, lower eight bits of exit_code containthe stop signal; otherwise,SIGTRAP.
When !PT_SEIZED, it’s used only for group stop trap with stop signalnumber as exit_code and no siginfo.
Context
Must be called withcurrent->sighand->siglock held, which may bereleased and re-acquired before returning with intervening sleep.
- voiddo_freezer_trap(void)¶
handle the freezer jobctl trap
Parameters
voidno arguments
Description
Puts the task into frozen state, if only the task is not about to quit.In this case it drops JOBCTL_TRAP_FREEZE.
Context
Must be called withcurrent->sighand->siglock held,which is always released before returning.
- voidsignal_delivered(structksignal*ksig,intstepping)¶
called after signal delivery to update blocked signals
Parameters
structksignal*ksigkernel signal struct
intsteppingnonzero if debugger single-step or block-step in use
Description
This function should be called when a signal has successfully beendelivered. It updates the blocked signals accordingly (ksig->ka.sa.sa_maskis always blocked), and the signal itself is blocked unlessSA_NODEFERis set inksig->ka.sa.sa_flags. Tracing is notified.
- longsys_restart_syscall(void)¶
restart a system call
Parameters
voidno arguments
- voidset_current_blocked(sigset_t*newset)¶
change current->blocked mask
Parameters
sigset_t*newsetnew mask
Description
It is wrong to change ->blocked directly, this helper should be usedto ensure the process can’t miss a shared signal we are going to block.
- longsys_rt_sigprocmask(inthow,sigset_t__user*nset,sigset_t__user*oset,size_tsigsetsize)¶
change the list of currently blocked signals
Parameters
inthowwhether to add, remove, or set signals
sigset_t__user*nsetstores pending signals
sigset_t__user*osetprevious value of signal mask if non-null
size_tsigsetsizesize of sigset_t type
- longsys_rt_sigpending(sigset_t__user*uset,size_tsigsetsize)¶
examine a pending signal that has been raised while blocked
Parameters
sigset_t__user*usetstores pending signals
size_tsigsetsizesize of sigset_t type or larger
- voidcopy_siginfo_to_external32(structcompat_siginfo*to,conststructkernel_siginfo*from)¶
copy a kernel siginfo into a compat user siginfo
Parameters
structcompat_siginfo*tocompat siginfo destination
conststructkernel_siginfo*fromkernel siginfo source
Note
This function does not work properly for the SIGCHLD on x32, butfortunately it doesn’t have to. The only valid callers for this function arecopy_siginfo_to_user32, which is overriden for x32 and the coredump code.The latter does not care because SIGCHLD will never cause a coredump.
- intdo_sigtimedwait(constsigset_t*which,kernel_siginfo_t*info,conststructtimespec64*ts)¶
wait for queued signals specified inwhich
Parameters
constsigset_t*whichqueued signals to wait for
kernel_siginfo_t*infoif non-null, the signal’s siginfo is returned here
conststructtimespec64*tsupper bound on process time suspension
- longsys_rt_sigtimedwait(constsigset_t__user*uthese,siginfo_t__user*uinfo,conststruct__kernel_timespec__user*uts,size_tsigsetsize)¶
synchronously wait for queued signals specified inuthese
Parameters
constsigset_t__user*uthesequeued signals to wait for
siginfo_t__user*uinfoif non-null, the signal’s siginfo is returned here
conststruct__kernel_timespec__user*utsupper bound on process time suspension
size_tsigsetsizesize of sigset_t type
- longsys_kill(pid_tpid,intsig)¶
send a signal to a process
Parameters
pid_tpidthe PID of the process
intsigsignal to be sent
- longsys_pidfd_send_signal(intpidfd,intsig,siginfo_t__user*info,unsignedintflags)¶
Signal a process through a pidfd
Parameters
intpidfdfile descriptor of the process
intsigsignal to send
siginfo_t__user*infosignal info
unsignedintflagsfuture flags
Description
Send the signal to the thread group or to the individual thread dependingon PIDFD_THREAD.In the future extension toflags may be used to override the default scopeofpidfd.
Return
0 on success, negative errno on failure
- longsys_tgkill(pid_ttgid,pid_tpid,intsig)¶
send signal to one specific thread
Parameters
pid_ttgidthe thread group ID of the thread
pid_tpidthe PID of the thread
intsigsignal to be sent
Description
This syscall also checks thetgid and returns -ESRCH even if the PIDexists but it’s not belonging to the target process anymore. Thismethod solves the problem of threads exiting and PIDs getting reused.
- longsys_tkill(pid_tpid,intsig)¶
send signal to one specific task
Parameters
pid_tpidthe PID of the task
intsigsignal to be sent
Description
Send a signal to only one task, even if it’s a CLONE_THREAD task.
- longsys_rt_sigqueueinfo(pid_tpid,intsig,siginfo_t__user*uinfo)¶
send signal information to a signal
Parameters
pid_tpidthe PID of the thread
intsigsignal to be sent
siginfo_t__user*uinfosignal info to be sent
- longsys_sigpending(old_sigset_t__user*uset)¶
examine pending signals
Parameters
old_sigset_t__user*usetwhere mask of pending signal is returned
- longsys_sigprocmask(inthow,old_sigset_t__user*nset,old_sigset_t__user*oset)¶
examine and change blocked signals
Parameters
inthowwhether to add, remove, or set signals
old_sigset_t__user*nsetsignals to add or remove (if non-null)
old_sigset_t__user*osetprevious value of signal mask if non-null
Description
Some platforms have their own version with special arguments;others support only sys_rt_sigprocmask.
- longsys_rt_sigaction(intsig,conststructsigaction__user*act,structsigaction__user*oact,size_tsigsetsize)¶
alter an action taken by a process
Parameters
intsigsignal to be sent
conststructsigaction__user*actnew sigaction
structsigaction__user*oactused to save the previous sigaction
size_tsigsetsizesize of sigset_t type
- longsys_rt_sigsuspend(sigset_t__user*unewset,size_tsigsetsize)¶
replace the signal mask for a value with theunewset value until a signal is received
Parameters
sigset_t__user*unewsetnew signal mask value
size_tsigsetsizesize of sigset_t type
- kthread_create¶
kthread_create(threadfn,data,namefmt,arg...)
create a kthread on the current node
Parameters
threadfnthe function to run in the thread
datadata pointer for
threadfn()namefmtprintf-style format string for the thread name
arg...arguments fornamefmt.
Description
This macro will create a kthread on the current node, leaving it inthe stopped state. This is just a helper forkthread_create_on_node();see the documentation there for more details.
- kthread_run¶
kthread_run(threadfn,data,namefmt,...)
create and wake a thread.
Parameters
threadfnthe function to run until signal_pending(current).
datadata ptr forthreadfn.
namefmtprintf-style name for the thread.
...variable arguments
Description
Convenient wrapper forkthread_create() followed bywake_up_process(). Returns the kthread or ERR_PTR(-ENOMEM).
- structtask_struct*kthread_run_on_cpu(int(*threadfn)(void*data),void*data,unsignedintcpu,constchar*namefmt)¶
create and wake a cpu bound thread.
Parameters
int(*threadfn)(void*data)the function to run until signal_pending(current).
void*datadata ptr forthreadfn.
unsignedintcpuThe cpu on which the thread should be bound,
constchar*namefmtprintf-style name for the thread. Format is restrictedto “name.*``u``”. Code fills in cpu number.
Description
Convenient wrapper forkthread_create_on_cpu()followed bywake_up_process(). Returns the kthread orERR_PTR(-ENOMEM).
- kthread_run_worker¶
kthread_run_worker(flags,namefmt,...)
create and wake a kthread worker.
Parameters
flagsflags modifying the default behavior of the worker
namefmtprintf-style name for the thread.
...variable arguments
Description
Convenient wrapper forkthread_create_worker() followed bywake_up_process(). Returns the kthread_worker or ERR_PTR(-ENOMEM).
- structkthread_worker*kthread_run_worker_on_cpu(intcpu,unsignedintflags,constcharnamefmt[])¶
create and wake a cpu bound kthread worker.
Parameters
intcpuCPU number
unsignedintflagsflags modifying the default behavior of the worker
constcharnamefmt[]printf-style name for the thread. Format is restrictedto “name.*``u``”. Code fills in cpu number.
Description
Convenient wrapper forkthread_create_worker_on_cpu()followed bywake_up_process(). Returns the kthread_worker orERR_PTR(-ENOMEM).
- boolkthread_should_stop(void)¶
should this kthread return now?
Parameters
voidno arguments
Description
When someone callskthread_stop() on your kthread, it will be wokenand this will return true. You should then return, and your returnvalue will be passed through tokthread_stop().
- boolkthread_should_park(void)¶
should this kthread park now?
Parameters
voidno arguments
Description
When someone callskthread_park() on your kthread, it will be wokenand this will return true. You should then do the necessarycleanup and callkthread_parkme()
Similar tokthread_should_stop(), but this keeps the thread aliveand in a park position.kthread_unpark() “restarts” the thread andcalls the thread function again.
- boolkthread_freezable_should_stop(bool*was_frozen)¶
should this freezable kthread return now?
Parameters
bool*was_frozenoptional out parameter, indicates whether
currentwas frozen
Description
kthread_should_stop() for freezable kthreads, which will enterrefrigerator if necessary. This function is safe fromkthread_stop() /freezer deadlock and freezable kthreads should use this function insteadof callingtry_to_freeze() directly.
- void*kthread_func(structtask_struct*task)¶
return the function specified on kthread creation
Parameters
structtask_struct*taskkthread task in question
Description
Returns NULL if the task is not a kthread.
- void*kthread_data(structtask_struct*task)¶
return data value specified on kthread creation
Parameters
structtask_struct*taskkthread task in question
Description
Return the data value specified when kthreadtask was created.The caller is responsible for ensuring the validity oftask whencalling this function.
- void__noreturnkthread_exit(longresult)¶
Cause the current kthread returnresult to
kthread_stop().
Parameters
longresultThe integer value to return to
kthread_stop().
Description
While kthread_exit can be called directly, it exists so thatfunctions which do some additional work in non-modular code such asmodule_put_and_kthread_exit can be implemented.
Does not return.
- void__noreturnkthread_complete_and_exit(structcompletion*comp,longcode)¶
Exit the current kthread.
Parameters
structcompletion*compCompletion to complete
longcodeThe integer value to return to
kthread_stop().
Description
If present, completecomp and then return code tokthread_stop().
A kernel thread whose module may be removed after the completion ofcomp can use this function to exit safely.
Does not return.
- structtask_struct*kthread_create_on_node(int(*threadfn)(void*data),void*data,intnode,constcharnamefmt[],...)¶
create a kthread.
Parameters
int(*threadfn)(void*data)the function to run until signal_pending(current).
void*datadata ptr forthreadfn.
intnodetask and thread structures for the thread are allocated on this node
constcharnamefmt[]printf-style name for the thread.
...variable arguments
Description
This helper function creates and names a kernelthread. The thread will be stopped: usewake_up_process() to startit. See alsokthread_run(). The new thread has SCHED_NORMAL policy andis affine to all CPUs.
If thread is going to be bound on a particular cpu, give its nodeinnode, to get NUMA affinity for kthread stack, or else give NUMA_NO_NODE.When woken, the thread will runthreadfn() withdata as itsargument.threadfn() can either return directly if it is astandalone thread for which no one will callkthread_stop(), orreturn when ‘kthread_should_stop()’ is true (which meanskthread_stop() has been called). The return value should be zeroor a negative error number; it will be passed tokthread_stop().
Returns a task_struct or ERR_PTR(-ENOMEM) or ERR_PTR(-EINTR).
- voidkthread_bind(structtask_struct*p,unsignedintcpu)¶
bind a just-created kthread to a cpu.
Parameters
structtask_struct*pthread created by
kthread_create().unsignedintcpucpu (might not be online, must be possible) fork to run on.
Description
This function is equivalent toset_cpus_allowed(),except thatcpu doesn’t need to be online, and the thread must bestopped (i.e., just returned fromkthread_create()).
- structtask_struct*kthread_create_on_cpu(int(*threadfn)(void*data),void*data,unsignedintcpu,constchar*namefmt)¶
Create a cpu bound kthread
Parameters
int(*threadfn)(void*data)the function to run until signal_pending(current).
void*datadata ptr forthreadfn.
unsignedintcpuThe cpu on which the thread should be bound,
constchar*namefmtprintf-style name for the thread. Format is restrictedto “name.*``u``”. Code fills in cpu number.
Description
This helper function creates and names a kernel thread
- voidkthread_unpark(structtask_struct*k)¶
unpark a thread created by
kthread_create().
Parameters
structtask_struct*kthread created by
kthread_create().
Description
Setskthread_should_park() fork to return false, wakes it, andwaits for it to return. If the thread is marked percpu then itsbound to the cpu again.
- intkthread_park(structtask_struct*k)¶
park a thread created by
kthread_create().
Parameters
structtask_struct*kthread created by
kthread_create().
Description
Setskthread_should_park() fork to return true, wakes it, andwaits for it to return. This can also be called afterkthread_create()instead of callingwake_up_process(): the thread will park withoutcallingthreadfn().
Returns 0 if the thread is parked, -ENOSYS if the thread exited.If called by the kthread itself just the park bit is set.
- intkthread_stop(structtask_struct*k)¶
stop a thread created by
kthread_create().
Parameters
structtask_struct*kthread created by
kthread_create().
Description
Setskthread_should_stop() fork to return true, wakes it, andwaits for it to exit. This can also be called afterkthread_create()instead of callingwake_up_process(): the thread will exit withoutcallingthreadfn().
Ifthreadfn() may callkthread_exit() itself, the caller must ensuretask_struct can’t go away.
Returns the result ofthreadfn(), or-EINTR ifwake_up_process()was never called.
- intkthread_stop_put(structtask_struct*k)¶
stop a thread and put its task struct
Parameters
structtask_struct*kthread created by
kthread_create().
Description
Stops a thread created bykthread_create() and put its task_struct.Only use when holding an extra taskstructreference obtained bycallingget_task_struct().
- intkthread_worker_fn(void*worker_ptr)¶
kthread function to process kthread_worker
Parameters
void*worker_ptrpointer to initialized kthread_worker
Description
This function implements the main cycle of kthread worker. It processeswork_list until it is stopped withkthread_stop(). It sleeps when the queueis empty.
The works are not allowed to keep any locks, disable preemption or interruptswhen they finish. There is defined a safe point for freezing when one workfinishes and before a new one is started.
Also the works must not be handled by more than one worker at the same time,see alsokthread_queue_work().
- structkthread_worker*kthread_create_worker_on_node(unsignedintflags,intnode,constcharnamefmt[],...)¶
create a kthread worker
Parameters
unsignedintflagsflags modifying the default behavior of the worker
intnodetask structure for the thread is allocated on this node
constcharnamefmt[]printf-style name for the kthread worker (task).
...variable arguments
Description
Returns a pointer to the allocated worker on success, ERR_PTR(-ENOMEM)when the needed structures could not get allocated, and ERR_PTR(-EINTR)when the caller was killed by a fatal signal.
- structkthread_worker*kthread_create_worker_on_cpu(intcpu,unsignedintflags,constcharnamefmt[])¶
create a kthread worker and bind it to a given CPU and the associated NUMA node.
Parameters
intcpuCPU number
unsignedintflagsflags modifying the default behavior of the worker
constcharnamefmt[]printf-style name for the thread. Format is restrictedto “name.*``u``”. Code fills in cpu number.
Description
Use a valid CPU number if you want to bind the kthread workerto the given CPU and the associated NUMA node.
A good practice is to add the cpu number also into the worker name.For example, use kthread_create_worker_on_cpu(cpu, “helper/d”, cpu).
CPU hotplug:The kthread worker API is simple and generic. It just provides a wayto create, use, and destroy workers.
It is up to the API user how to handle CPU hotplug. They have to decidehow to handle pending work items, prevent queuing new ones, andrestore the functionality when the CPU goes off and on. There are afew catches:
CPU affinity gets lost when it is scheduled on an offline CPU.
The worker might not exist when the CPU was off when the usercreated the workers.
Good practice is to implement two CPU hotplug callbacks and todestroy/create the worker when the CPU goes down/up.
Return
The pointer to the allocated worker on success, ERR_PTR(-ENOMEM)when the needed structures could not get allocated, and ERR_PTR(-EINTR)when the caller was killed by a fatal signal.
- boolkthread_queue_work(structkthread_worker*worker,structkthread_work*work)¶
queue a kthread_work
Parameters
structkthread_worker*workertarget kthread_worker
structkthread_work*workkthread_work to queue
Description
Queuework to work processortask for async execution.taskmust have been created withkthread_create_worker(). Returnstrueifwork was successfully queued,false if it was already pending.
Reinitialize the work if it needs to be used by another worker.For example, when the worker was stopped and started again.
- voidkthread_delayed_work_timer_fn(structtimer_list*t)¶
callback that queues the associated kthread delayed work when the timer expires.
Parameters
structtimer_list*tpointer to the expired timer
Description
The format of the function is defined bystructtimer_list.It should have been called from irqsafe timer with irq already off.
- boolkthread_queue_delayed_work(structkthread_worker*worker,structkthread_delayed_work*dwork,unsignedlongdelay)¶
queue the associated kthread work after a delay.
Parameters
structkthread_worker*workertarget kthread_worker
structkthread_delayed_work*dworkkthread_delayed_work to queue
unsignedlongdelaynumber of jiffies to wait before queuing
Description
If the work has not been pending it starts a timer that will queuethe work after the givendelay. Ifdelay is zero, it queues thework immediately.
Return
false if thework has already been pending. It means thateither the timer was running or the work was queued. It returnstrueotherwise.
- voidkthread_flush_work(structkthread_work*work)¶
flush a kthread_work
Parameters
structkthread_work*workwork to flush
Description
Ifwork is queued or executing, wait for it to finish execution.
- boolkthread_mod_delayed_work(structkthread_worker*worker,structkthread_delayed_work*dwork,unsignedlongdelay)¶
modify delay of or queue a kthread delayed work
Parameters
structkthread_worker*workerkthread worker to use
structkthread_delayed_work*dworkkthread delayed work to queue
unsignedlongdelaynumber of jiffies to wait before queuing
Description
Ifdwork is idle, equivalent tokthread_queue_delayed_work(). Otherwise,modifydwork’s timer so that it expires afterdelay. Ifdelay is zero,work is guaranteed to be queued immediately.
A special case is when the work is being canceled in parallel.It might be caused either by the realkthread_cancel_delayed_work_sync()or yet anotherkthread_mod_delayed_work() call. We let the other commandwin and returntrue here. The return value can be used for referencecounting and the number of queued works stays the same. Anyway, the calleris supposed to synchronize these operations a reasonable way.
This function is safe to call from any context including IRQ handler.See__kthread_cancel_work() andkthread_delayed_work_timer_fn()for details.
Return
false ifdwork was idle and queued,true otherwise.
- boolkthread_cancel_work_sync(structkthread_work*work)¶
cancel a kthread work and wait for it to finish
Parameters
structkthread_work*workthe kthread work to cancel
Description
Cancelwork and wait for its execution to finish. This functioncan be used even if the work re-queues itself. On return from thisfunction,work is guaranteed to be not pending or executing on any CPU.
kthread_cancel_work_sync(delayed_work->work) must not be used fordelayed_work’s. Usekthread_cancel_delayed_work_sync() instead.
The caller must ensure that the worker on whichwork was lastqueued can’t be destroyed before this function returns.
Return
true ifwork was pending,false otherwise.
- boolkthread_cancel_delayed_work_sync(structkthread_delayed_work*dwork)¶
cancel a kthread delayed work and wait for it to finish.
Parameters
structkthread_delayed_work*dworkthe kthread delayed work to cancel
Description
This iskthread_cancel_work_sync() for delayed works.
Return
true ifdwork was pending,false otherwise.
- voidkthread_flush_worker(structkthread_worker*worker)¶
flush all current works on a kthread_worker
Parameters
structkthread_worker*workerworker to flush
Description
Wait until all currently executing or pending works onworker arefinished.
- voidkthread_destroy_worker(structkthread_worker*worker)¶
destroy a kthread worker
Parameters
structkthread_worker*workerworker to be destroyed
Description
Flush and destroyworker. The simple flush is enough because the kthreadworker API is used only in trivial scenarios. There are no multi-step statemachines needed.
Note that this function is not responsible for handling delayed work, socaller should be responsible for queuing or canceling all delayed work itemsbefore invoke this function.
- voidkthread_use_mm(structmm_struct*mm)¶
make the calling kthread operate on an address space
Parameters
structmm_struct*mmaddress space to operate on
- voidkthread_unuse_mm(structmm_struct*mm)¶
reverse the effect of
kthread_use_mm()
Parameters
structmm_struct*mmaddress space to operate on
- voidkthread_associate_blkcg(structcgroup_subsys_state*css)¶
associate blkcg to current kthread
Parameters
structcgroup_subsys_state*cssthe cgroup info
Description
Current thread must be a kthread. The thread is running jobs on behalf ofother threads. In some cases, we expect the jobs attach cgroup info oforiginal threads instead of that of current thread. This function storesoriginal thread’s cgroup info in current kthread context for laterretrieval.
Reference counting¶
- voidrefcount_set(refcount_t*r,intn)¶
set a refcount’s value
Parameters
refcount_t*rthe refcount
intnvalue to which the refcount will be set
- voidrefcount_set_release(refcount_t*r,intn)¶
set a refcount’s value with release ordering
Parameters
refcount_t*rthe refcount
intnvalue to which the refcount will be set
Description
This function should be used when memory occupied by the object might bereused to store another object -- consider SLAB_TYPESAFE_BY_RCU.
Provides release memory ordering which will order previous memory operationsagainst this store. This ensures all updates to this object are visibleonce the refcount is set and stale values from the object previouslyoccupying this memory are overwritten with new ones.
This function should be called only after new object is fully initialized.After this call the object should be considered visible to other tasks evenif it was not yet added into an object collection normally used to discoverit. This is because other tasks might have discovered the object previouslyoccupying the same memory and after memory reuse they can succeed in takingrefcount to the new object and start using it.
- unsignedintrefcount_read(constrefcount_t*r)¶
get a refcount’s value
Parameters
constrefcount_t*rthe refcount
Return
the refcount’s value
- boolrefcount_add_not_zero(inti,refcount_t*r)¶
add a value to a refcount unless it is 0
Parameters
intithe value to add to the refcount
refcount_t*rthe refcount
Description
Will saturate at REFCOUNT_SATURATED and WARN.
Provides no memory ordering, it is assumed the caller has guaranteed theobject memory to be stable (RCU, etc.). It does provide a control dependencyand thereby orders future stores. See the comment on top.
Use of this function is not recommended for the normal reference countinguse case in which references are taken and released one at a time. In thesecases,refcount_inc(), or one of its variants, should instead be used toincrement a reference count.
Return
false if the passed refcount is 0, true otherwise
- boolrefcount_add_not_zero_acquire(inti,refcount_t*r)¶
add a value to a refcount with acquire ordering unless it is 0
Parameters
intithe value to add to the refcount
refcount_t*rthe refcount
Description
Will saturate at REFCOUNT_SATURATED and WARN.
This function should be used when memory occupied by the object might bereused to store another object -- consider SLAB_TYPESAFE_BY_RCU.
Provides acquire memory ordering on success, it is assumed the caller hasguaranteed the object memory to be stable (RCU, etc.). It does provide acontrol dependency and thereby orders future stores. See the comment on top.
Use of this function is not recommended for the normal reference countinguse case in which references are taken and released one at a time. In thesecases,refcount_inc_not_zero_acquire() should instead be used to increment areference count.
Return
false if the passed refcount is 0, true otherwise
- voidrefcount_add(inti,refcount_t*r)¶
add a value to a refcount
Parameters
intithe value to add to the refcount
refcount_t*rthe refcount
Description
Similar toatomic_add(), but will saturate at REFCOUNT_SATURATED and WARN.
Provides no memory ordering, it is assumed the caller has guaranteed theobject memory to be stable (RCU, etc.). It does provide a control dependencyand thereby orders future stores. See the comment on top.
Use of this function is not recommended for the normal reference countinguse case in which references are taken and released one at a time. In thesecases,refcount_inc(), or one of its variants, should instead be used toincrement a reference count.
- boolrefcount_inc_not_zero(refcount_t*r)¶
increment a refcount unless it is 0
Parameters
refcount_t*rthe refcount to increment
Description
Similar toatomic_inc_not_zero(), but will saturate at REFCOUNT_SATURATEDand WARN.
Provides no memory ordering, it is assumed the caller has guaranteed theobject memory to be stable (RCU, etc.). It does provide a control dependencyand thereby orders future stores. See the comment on top.
Return
true if the increment was successful, false otherwise
- boolrefcount_inc_not_zero_acquire(refcount_t*r)¶
increment a refcount with acquire ordering unless it is 0
Parameters
refcount_t*rthe refcount to increment
Description
Similar torefcount_inc_not_zero(), but provides acquire memory ordering onsuccess.
This function should be used when memory occupied by the object might bereused to store another object -- consider SLAB_TYPESAFE_BY_RCU.
Provides acquire memory ordering on success, it is assumed the caller hasguaranteed the object memory to be stable (RCU, etc.). It does provide acontrol dependency and thereby orders future stores. See the comment on top.
Return
true if the increment was successful, false otherwise
- voidrefcount_inc(refcount_t*r)¶
increment a refcount
Parameters
refcount_t*rthe refcount to increment
Description
Similar toatomic_inc(), but will saturate at REFCOUNT_SATURATED and WARN.
Provides no memory ordering, it is assumed the caller already has areference on the object.
Will WARN if the refcount is 0, as this represents a possible use-after-freecondition.
- boolrefcount_sub_and_test(inti,refcount_t*r)¶
subtract from a refcount and test if it is 0
Parameters
intiamount to subtract from the refcount
refcount_t*rthe refcount
Description
Similar toatomic_dec_and_test(), but it will WARN, return false andultimately leak on underflow and will fail to decrement when saturatedat REFCOUNT_SATURATED.
Provides release memory ordering, such that prior loads and stores are donebefore, and provides an acquire ordering on success such thatfree()must come after.
Use of this function is not recommended for the normal reference countinguse case in which references are taken and released one at a time. In thesecases,refcount_dec(), or one of its variants, should instead be used todecrement a reference count.
Return
true if the resulting refcount is 0, false otherwise
- boolrefcount_dec_and_test(refcount_t*r)¶
decrement a refcount and test if it is 0
Parameters
refcount_t*rthe refcount
Description
Similar toatomic_dec_and_test(), it will WARN on underflow and fail todecrement when saturated at REFCOUNT_SATURATED.
Provides release memory ordering, such that prior loads and stores are donebefore, and provides an acquire ordering on success such thatfree()must come after.
Return
true if the resulting refcount is 0, false otherwise
- voidrefcount_dec(refcount_t*r)¶
decrement a refcount
Parameters
refcount_t*rthe refcount
Description
Similar toatomic_dec(), it will WARN on underflow and fail to decrementwhen saturated at REFCOUNT_SATURATED.
Provides release memory ordering, such that prior loads and stores are donebefore.
- boolrefcount_dec_if_one(refcount_t*r)¶
decrement a refcount if it is 1
Parameters
refcount_t*rthe refcount
Description
No atomic_t counterpart, it attempts a 1 -> 0 transition and returns thesuccess thereof.
Like all decrement operations, it provides release memory order and providesa control dependency.
It can be used like a try-delete operator; this explicit case is providedand not cmpxchg in generic, because that would allow implementing unsafeoperations.
Return
true if the resulting refcount is 0, false otherwise
- boolrefcount_dec_not_one(refcount_t*r)¶
decrement a refcount if it is not 1
Parameters
refcount_t*rthe refcount
Description
No atomic_t counterpart, it decrements unless the value is 1, in which caseit will return false.
Was often done like: atomic_add_unless(var, -1, 1)
Return
true if the decrement operation was successful, false otherwise
- boolrefcount_dec_and_mutex_lock(refcount_t*r,structmutex*lock)¶
return holding mutex if able to decrement refcount to 0
Parameters
refcount_t*rthe refcount
structmutex*lockthe mutex to be locked
Description
Similar toatomic_dec_and_mutex_lock(), it will WARN on underflow and failto decrement when saturated at REFCOUNT_SATURATED.
Provides release memory ordering, such that prior loads and stores are donebefore, and provides a control dependency such thatfree() must come after.See the comment on top.
Return
true and hold mutex if able to decrement refcount to 0, falseotherwise
- boolrefcount_dec_and_lock(refcount_t*r,spinlock_t*lock)¶
return holding spinlock if able to decrement refcount to 0
Parameters
refcount_t*rthe refcount
spinlock_t*lockthe spinlock to be locked
Description
Similar toatomic_dec_and_lock(), it will WARN on underflow and fail todecrement when saturated at REFCOUNT_SATURATED.
Provides release memory ordering, such that prior loads and stores are donebefore, and provides a control dependency such thatfree() must come after.See the comment on top.
Return
true and hold spinlock if able to decrement refcount to 0, falseotherwise
- boolrefcount_dec_and_lock_irqsave(refcount_t*r,spinlock_t*lock,unsignedlong*flags)¶
return holding spinlock with disabled interrupts if able to decrement refcount to 0
Parameters
refcount_t*rthe refcount
spinlock_t*lockthe spinlock to be locked
unsignedlong*flagssaved IRQ-flags if the is acquired
Description
Same asrefcount_dec_and_lock() above except that the spinlock is acquiredwith disabled interrupts.
Return
true and hold spinlock if able to decrement refcount to 0, falseotherwise
Atomics¶
- intatomic_read(constatomic_t*v)¶
atomic load with relaxed ordering
Parameters
constatomic_t*vpointer to atomic_t
Description
Atomically loads the value ofv with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_read() there.
Return
The value loaded fromv.
- intatomic_read_acquire(constatomic_t*v)¶
atomic load with acquire ordering
Parameters
constatomic_t*vpointer to atomic_t
Description
Atomically loads the value ofv with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic_read_acquire() there.
Return
The value loaded fromv.
- voidatomic_set(atomic_t*v,inti)¶
atomic set with relaxed ordering
Parameters
atomic_t*vpointer to atomic_t
intiint value to assign
Description
Atomically setsv toi with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_set() there.
Return
Nothing.
- voidatomic_set_release(atomic_t*v,inti)¶
atomic set with release ordering
Parameters
atomic_t*vpointer to atomic_t
intiint value to assign
Description
Atomically setsv toi with release ordering.
Unsafe to use in noinstr code; useraw_atomic_set_release() there.
Return
Nothing.
- voidatomic_add(inti,atomic_t*v)¶
atomic add with relaxed ordering
Parameters
intiint value to add
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v +i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_add() there.
Return
Nothing.
- intatomic_add_return(inti,atomic_t*v)¶
atomic add with full ordering
Parameters
intiint value to add
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v +i) with full ordering.
Unsafe to use in noinstr code; useraw_atomic_add_return() there.
Return
The updated value ofv.
- intatomic_add_return_acquire(inti,atomic_t*v)¶
atomic add with acquire ordering
Parameters
intiint value to add
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v +i) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic_add_return_acquire() there.
Return
The updated value ofv.
- intatomic_add_return_release(inti,atomic_t*v)¶
atomic add with release ordering
Parameters
intiint value to add
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v +i) with release ordering.
Unsafe to use in noinstr code; useraw_atomic_add_return_release() there.
Return
The updated value ofv.
- intatomic_add_return_relaxed(inti,atomic_t*v)¶
atomic add with relaxed ordering
Parameters
intiint value to add
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v +i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_add_return_relaxed() there.
Return
The updated value ofv.
- intatomic_fetch_add(inti,atomic_t*v)¶
atomic add with full ordering
Parameters
intiint value to add
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v +i) with full ordering.
Unsafe to use in noinstr code; useraw_atomic_fetch_add() there.
Return
The original value ofv.
- intatomic_fetch_add_acquire(inti,atomic_t*v)¶
atomic add with acquire ordering
Parameters
intiint value to add
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v +i) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic_fetch_add_acquire() there.
Return
The original value ofv.
- intatomic_fetch_add_release(inti,atomic_t*v)¶
atomic add with release ordering
Parameters
intiint value to add
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v +i) with release ordering.
Unsafe to use in noinstr code; useraw_atomic_fetch_add_release() there.
Return
The original value ofv.
- intatomic_fetch_add_relaxed(inti,atomic_t*v)¶
atomic add with relaxed ordering
Parameters
intiint value to add
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v +i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_fetch_add_relaxed() there.
Return
The original value ofv.
- voidatomic_sub(inti,atomic_t*v)¶
atomic subtract with relaxed ordering
Parameters
intiint value to subtract
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v -i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_sub() there.
Return
Nothing.
- intatomic_sub_return(inti,atomic_t*v)¶
atomic subtract with full ordering
Parameters
intiint value to subtract
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v -i) with full ordering.
Unsafe to use in noinstr code; useraw_atomic_sub_return() there.
Return
The updated value ofv.
- intatomic_sub_return_acquire(inti,atomic_t*v)¶
atomic subtract with acquire ordering
Parameters
intiint value to subtract
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v -i) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic_sub_return_acquire() there.
Return
The updated value ofv.
- intatomic_sub_return_release(inti,atomic_t*v)¶
atomic subtract with release ordering
Parameters
intiint value to subtract
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v -i) with release ordering.
Unsafe to use in noinstr code; useraw_atomic_sub_return_release() there.
Return
The updated value ofv.
- intatomic_sub_return_relaxed(inti,atomic_t*v)¶
atomic subtract with relaxed ordering
Parameters
intiint value to subtract
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v -i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_sub_return_relaxed() there.
Return
The updated value ofv.
- intatomic_fetch_sub(inti,atomic_t*v)¶
atomic subtract with full ordering
Parameters
intiint value to subtract
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v -i) with full ordering.
Unsafe to use in noinstr code; useraw_atomic_fetch_sub() there.
Return
The original value ofv.
- intatomic_fetch_sub_acquire(inti,atomic_t*v)¶
atomic subtract with acquire ordering
Parameters
intiint value to subtract
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v -i) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic_fetch_sub_acquire() there.
Return
The original value ofv.
- intatomic_fetch_sub_release(inti,atomic_t*v)¶
atomic subtract with release ordering
Parameters
intiint value to subtract
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v -i) with release ordering.
Unsafe to use in noinstr code; useraw_atomic_fetch_sub_release() there.
Return
The original value ofv.
- intatomic_fetch_sub_relaxed(inti,atomic_t*v)¶
atomic subtract with relaxed ordering
Parameters
intiint value to subtract
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v -i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_fetch_sub_relaxed() there.
Return
The original value ofv.
- voidatomic_inc(atomic_t*v)¶
atomic increment with relaxed ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v + 1) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_inc() there.
Return
Nothing.
- intatomic_inc_return(atomic_t*v)¶
atomic increment with full ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v + 1) with full ordering.
Unsafe to use in noinstr code; useraw_atomic_inc_return() there.
Return
The updated value ofv.
- intatomic_inc_return_acquire(atomic_t*v)¶
atomic increment with acquire ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v + 1) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic_inc_return_acquire() there.
Return
The updated value ofv.
- intatomic_inc_return_release(atomic_t*v)¶
atomic increment with release ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v + 1) with release ordering.
Unsafe to use in noinstr code; useraw_atomic_inc_return_release() there.
Return
The updated value ofv.
- intatomic_inc_return_relaxed(atomic_t*v)¶
atomic increment with relaxed ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v + 1) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_inc_return_relaxed() there.
Return
The updated value ofv.
- intatomic_fetch_inc(atomic_t*v)¶
atomic increment with full ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v + 1) with full ordering.
Unsafe to use in noinstr code; useraw_atomic_fetch_inc() there.
Return
The original value ofv.
- intatomic_fetch_inc_acquire(atomic_t*v)¶
atomic increment with acquire ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v + 1) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic_fetch_inc_acquire() there.
Return
The original value ofv.
- intatomic_fetch_inc_release(atomic_t*v)¶
atomic increment with release ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v + 1) with release ordering.
Unsafe to use in noinstr code; useraw_atomic_fetch_inc_release() there.
Return
The original value ofv.
- intatomic_fetch_inc_relaxed(atomic_t*v)¶
atomic increment with relaxed ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v + 1) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_fetch_inc_relaxed() there.
Return
The original value ofv.
- voidatomic_dec(atomic_t*v)¶
atomic decrement with relaxed ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v - 1) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_dec() there.
Return
Nothing.
- intatomic_dec_return(atomic_t*v)¶
atomic decrement with full ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v - 1) with full ordering.
Unsafe to use in noinstr code; useraw_atomic_dec_return() there.
Return
The updated value ofv.
- intatomic_dec_return_acquire(atomic_t*v)¶
atomic decrement with acquire ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v - 1) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic_dec_return_acquire() there.
Return
The updated value ofv.
- intatomic_dec_return_release(atomic_t*v)¶
atomic decrement with release ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v - 1) with release ordering.
Unsafe to use in noinstr code; useraw_atomic_dec_return_release() there.
Return
The updated value ofv.
- intatomic_dec_return_relaxed(atomic_t*v)¶
atomic decrement with relaxed ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v - 1) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_dec_return_relaxed() there.
Return
The updated value ofv.
- intatomic_fetch_dec(atomic_t*v)¶
atomic decrement with full ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v - 1) with full ordering.
Unsafe to use in noinstr code; useraw_atomic_fetch_dec() there.
Return
The original value ofv.
- intatomic_fetch_dec_acquire(atomic_t*v)¶
atomic decrement with acquire ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v - 1) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic_fetch_dec_acquire() there.
Return
The original value ofv.
- intatomic_fetch_dec_release(atomic_t*v)¶
atomic decrement with release ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v - 1) with release ordering.
Unsafe to use in noinstr code; useraw_atomic_fetch_dec_release() there.
Return
The original value ofv.
- intatomic_fetch_dec_relaxed(atomic_t*v)¶
atomic decrement with relaxed ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v - 1) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_fetch_dec_relaxed() there.
Return
The original value ofv.
- voidatomic_and(inti,atomic_t*v)¶
atomic bitwise AND with relaxed ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v &i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_and() there.
Return
Nothing.
- intatomic_fetch_and(inti,atomic_t*v)¶
atomic bitwise AND with full ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v &i) with full ordering.
Unsafe to use in noinstr code; useraw_atomic_fetch_and() there.
Return
The original value ofv.
- intatomic_fetch_and_acquire(inti,atomic_t*v)¶
atomic bitwise AND with acquire ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v &i) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic_fetch_and_acquire() there.
Return
The original value ofv.
- intatomic_fetch_and_release(inti,atomic_t*v)¶
atomic bitwise AND with release ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v &i) with release ordering.
Unsafe to use in noinstr code; useraw_atomic_fetch_and_release() there.
Return
The original value ofv.
- intatomic_fetch_and_relaxed(inti,atomic_t*v)¶
atomic bitwise AND with relaxed ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v &i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_fetch_and_relaxed() there.
Return
The original value ofv.
- voidatomic_andnot(inti,atomic_t*v)¶
atomic bitwise AND NOT with relaxed ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v &~i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_andnot() there.
Return
Nothing.
- intatomic_fetch_andnot(inti,atomic_t*v)¶
atomic bitwise AND NOT with full ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v &~i) with full ordering.
Unsafe to use in noinstr code; useraw_atomic_fetch_andnot() there.
Return
The original value ofv.
- intatomic_fetch_andnot_acquire(inti,atomic_t*v)¶
atomic bitwise AND NOT with acquire ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v &~i) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic_fetch_andnot_acquire() there.
Return
The original value ofv.
- intatomic_fetch_andnot_release(inti,atomic_t*v)¶
atomic bitwise AND NOT with release ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v &~i) with release ordering.
Unsafe to use in noinstr code; useraw_atomic_fetch_andnot_release() there.
Return
The original value ofv.
- intatomic_fetch_andnot_relaxed(inti,atomic_t*v)¶
atomic bitwise AND NOT with relaxed ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v &~i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_fetch_andnot_relaxed() there.
Return
The original value ofv.
- voidatomic_or(inti,atomic_t*v)¶
atomic bitwise OR with relaxed ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v |i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_or() there.
Return
Nothing.
- intatomic_fetch_or(inti,atomic_t*v)¶
atomic bitwise OR with full ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v |i) with full ordering.
Unsafe to use in noinstr code; useraw_atomic_fetch_or() there.
Return
The original value ofv.
- intatomic_fetch_or_acquire(inti,atomic_t*v)¶
atomic bitwise OR with acquire ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v |i) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic_fetch_or_acquire() there.
Return
The original value ofv.
- intatomic_fetch_or_release(inti,atomic_t*v)¶
atomic bitwise OR with release ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v |i) with release ordering.
Unsafe to use in noinstr code; useraw_atomic_fetch_or_release() there.
Return
The original value ofv.
- intatomic_fetch_or_relaxed(inti,atomic_t*v)¶
atomic bitwise OR with relaxed ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v |i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_fetch_or_relaxed() there.
Return
The original value ofv.
- voidatomic_xor(inti,atomic_t*v)¶
atomic bitwise XOR with relaxed ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v ^i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_xor() there.
Return
Nothing.
- intatomic_fetch_xor(inti,atomic_t*v)¶
atomic bitwise XOR with full ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v ^i) with full ordering.
Unsafe to use in noinstr code; useraw_atomic_fetch_xor() there.
Return
The original value ofv.
- intatomic_fetch_xor_acquire(inti,atomic_t*v)¶
atomic bitwise XOR with acquire ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v ^i) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic_fetch_xor_acquire() there.
Return
The original value ofv.
- intatomic_fetch_xor_release(inti,atomic_t*v)¶
atomic bitwise XOR with release ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v ^i) with release ordering.
Unsafe to use in noinstr code; useraw_atomic_fetch_xor_release() there.
Return
The original value ofv.
- intatomic_fetch_xor_relaxed(inti,atomic_t*v)¶
atomic bitwise XOR with relaxed ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v ^i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_fetch_xor_relaxed() there.
Return
The original value ofv.
- intatomic_xchg(atomic_t*v,intnew)¶
atomic exchange with full ordering
Parameters
atomic_t*vpointer to atomic_t
intnewint value to assign
Description
Atomically updatesv tonew with full ordering.
Unsafe to use in noinstr code; useraw_atomic_xchg() there.
Return
The original value ofv.
- intatomic_xchg_acquire(atomic_t*v,intnew)¶
atomic exchange with acquire ordering
Parameters
atomic_t*vpointer to atomic_t
intnewint value to assign
Description
Atomically updatesv tonew with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic_xchg_acquire() there.
Return
The original value ofv.
- intatomic_xchg_release(atomic_t*v,intnew)¶
atomic exchange with release ordering
Parameters
atomic_t*vpointer to atomic_t
intnewint value to assign
Description
Atomically updatesv tonew with release ordering.
Unsafe to use in noinstr code; useraw_atomic_xchg_release() there.
Return
The original value ofv.
- intatomic_xchg_relaxed(atomic_t*v,intnew)¶
atomic exchange with relaxed ordering
Parameters
atomic_t*vpointer to atomic_t
intnewint value to assign
Description
Atomically updatesv tonew with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_xchg_relaxed() there.
Return
The original value ofv.
- intatomic_cmpxchg(atomic_t*v,intold,intnew)¶
atomic compare and exchange with full ordering
Parameters
atomic_t*vpointer to atomic_t
intoldint value to compare with
intnewint value to assign
Description
If (v ==old), atomically updatesv tonew with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic_cmpxchg() there.
Return
The original value ofv.
- intatomic_cmpxchg_acquire(atomic_t*v,intold,intnew)¶
atomic compare and exchange with acquire ordering
Parameters
atomic_t*vpointer to atomic_t
intoldint value to compare with
intnewint value to assign
Description
If (v ==old), atomically updatesv tonew with acquire ordering.Otherwise,v is not modified and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic_cmpxchg_acquire() there.
Return
The original value ofv.
- intatomic_cmpxchg_release(atomic_t*v,intold,intnew)¶
atomic compare and exchange with release ordering
Parameters
atomic_t*vpointer to atomic_t
intoldint value to compare with
intnewint value to assign
Description
If (v ==old), atomically updatesv tonew with release ordering.Otherwise,v is not modified and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic_cmpxchg_release() there.
Return
The original value ofv.
- intatomic_cmpxchg_relaxed(atomic_t*v,intold,intnew)¶
atomic compare and exchange with relaxed ordering
Parameters
atomic_t*vpointer to atomic_t
intoldint value to compare with
intnewint value to assign
Description
If (v ==old), atomically updatesv tonew with relaxed ordering.Otherwise,v is not modified and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic_cmpxchg_relaxed() there.
Return
The original value ofv.
- boolatomic_try_cmpxchg(atomic_t*v,int*old,intnew)¶
atomic compare and exchange with full ordering
Parameters
atomic_t*vpointer to atomic_t
int*oldpointer to int value to compare with
intnewint value to assign
Description
If (v ==old), atomically updatesv tonew with full ordering.Otherwise,v is not modified,old is updated to the current value ofv,and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic_try_cmpxchg() there.
Return
true if the exchange occured,false otherwise.
- boolatomic_try_cmpxchg_acquire(atomic_t*v,int*old,intnew)¶
atomic compare and exchange with acquire ordering
Parameters
atomic_t*vpointer to atomic_t
int*oldpointer to int value to compare with
intnewint value to assign
Description
If (v ==old), atomically updatesv tonew with acquire ordering.Otherwise,v is not modified,old is updated to the current value ofv,and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic_try_cmpxchg_acquire() there.
Return
true if the exchange occured,false otherwise.
- boolatomic_try_cmpxchg_release(atomic_t*v,int*old,intnew)¶
atomic compare and exchange with release ordering
Parameters
atomic_t*vpointer to atomic_t
int*oldpointer to int value to compare with
intnewint value to assign
Description
If (v ==old), atomically updatesv tonew with release ordering.Otherwise,v is not modified,old is updated to the current value ofv,and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic_try_cmpxchg_release() there.
Return
true if the exchange occured,false otherwise.
- boolatomic_try_cmpxchg_relaxed(atomic_t*v,int*old,intnew)¶
atomic compare and exchange with relaxed ordering
Parameters
atomic_t*vpointer to atomic_t
int*oldpointer to int value to compare with
intnewint value to assign
Description
If (v ==old), atomically updatesv tonew with relaxed ordering.Otherwise,v is not modified,old is updated to the current value ofv,and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic_try_cmpxchg_relaxed() there.
Return
true if the exchange occured,false otherwise.
- boolatomic_sub_and_test(inti,atomic_t*v)¶
atomic subtract and test if zero with full ordering
Parameters
intiint value to subtract
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v -i) with full ordering.
Unsafe to use in noinstr code; useraw_atomic_sub_and_test() there.
Return
true if the resulting value ofv is zero,false otherwise.
- boolatomic_dec_and_test(atomic_t*v)¶
atomic decrement and test if zero with full ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v - 1) with full ordering.
Unsafe to use in noinstr code; useraw_atomic_dec_and_test() there.
Return
true if the resulting value ofv is zero,false otherwise.
- boolatomic_inc_and_test(atomic_t*v)¶
atomic increment and test if zero with full ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v + 1) with full ordering.
Unsafe to use in noinstr code; useraw_atomic_inc_and_test() there.
Return
true if the resulting value ofv is zero,false otherwise.
- boolatomic_add_negative(inti,atomic_t*v)¶
atomic add and test if negative with full ordering
Parameters
intiint value to add
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v +i) with full ordering.
Unsafe to use in noinstr code; useraw_atomic_add_negative() there.
Return
true if the resulting value ofv is negative,false otherwise.
- boolatomic_add_negative_acquire(inti,atomic_t*v)¶
atomic add and test if negative with acquire ordering
Parameters
intiint value to add
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v +i) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic_add_negative_acquire() there.
Return
true if the resulting value ofv is negative,false otherwise.
- boolatomic_add_negative_release(inti,atomic_t*v)¶
atomic add and test if negative with release ordering
Parameters
intiint value to add
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v +i) with release ordering.
Unsafe to use in noinstr code; useraw_atomic_add_negative_release() there.
Return
true if the resulting value ofv is negative,false otherwise.
- boolatomic_add_negative_relaxed(inti,atomic_t*v)¶
atomic add and test if negative with relaxed ordering
Parameters
intiint value to add
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v +i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_add_negative_relaxed() there.
Return
true if the resulting value ofv is negative,false otherwise.
- intatomic_fetch_add_unless(atomic_t*v,inta,intu)¶
atomic add unless value with full ordering
Parameters
atomic_t*vpointer to atomic_t
intaint value to add
intuint value to compare with
Description
If (v !=u), atomically updatesv to (v +a) with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic_fetch_add_unless() there.
Return
The original value ofv.
- boolatomic_add_unless(atomic_t*v,inta,intu)¶
atomic add unless value with full ordering
Parameters
atomic_t*vpointer to atomic_t
intaint value to add
intuint value to compare with
Description
If (v !=u), atomically updatesv to (v +a) with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic_add_unless() there.
Return
true ifv was updated,false otherwise.
- boolatomic_inc_not_zero(atomic_t*v)¶
atomic increment unless zero with full ordering
Parameters
atomic_t*vpointer to atomic_t
Description
If (v != 0), atomically updatesv to (v + 1) with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic_inc_not_zero() there.
Return
true ifv was updated,false otherwise.
- boolatomic_inc_unless_negative(atomic_t*v)¶
atomic increment unless negative with full ordering
Parameters
atomic_t*vpointer to atomic_t
Description
If (v >= 0), atomically updatesv to (v + 1) with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic_inc_unless_negative() there.
Return
true ifv was updated,false otherwise.
- boolatomic_dec_unless_positive(atomic_t*v)¶
atomic decrement unless positive with full ordering
Parameters
atomic_t*vpointer to atomic_t
Description
If (v <= 0), atomically updatesv to (v - 1) with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic_dec_unless_positive() there.
Return
true ifv was updated,false otherwise.
- intatomic_dec_if_positive(atomic_t*v)¶
atomic decrement if positive with full ordering
Parameters
atomic_t*vpointer to atomic_t
Description
If (v > 0), atomically updatesv to (v - 1) with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic_dec_if_positive() there.
Return
The old value of (v - 1), regardless of whetherv was updated.
- s64atomic64_read(constatomic64_t*v)¶
atomic load with relaxed ordering
Parameters
constatomic64_t*vpointer to atomic64_t
Description
Atomically loads the value ofv with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic64_read() there.
Return
The value loaded fromv.
- s64atomic64_read_acquire(constatomic64_t*v)¶
atomic load with acquire ordering
Parameters
constatomic64_t*vpointer to atomic64_t
Description
Atomically loads the value ofv with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic64_read_acquire() there.
Return
The value loaded fromv.
- voidatomic64_set(atomic64_t*v,s64i)¶
atomic set with relaxed ordering
Parameters
atomic64_t*vpointer to atomic64_t
s64is64 value to assign
Description
Atomically setsv toi with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic64_set() there.
Return
Nothing.
- voidatomic64_set_release(atomic64_t*v,s64i)¶
atomic set with release ordering
Parameters
atomic64_t*vpointer to atomic64_t
s64is64 value to assign
Description
Atomically setsv toi with release ordering.
Unsafe to use in noinstr code; useraw_atomic64_set_release() there.
Return
Nothing.
- voidatomic64_add(s64i,atomic64_t*v)¶
atomic add with relaxed ordering
Parameters
s64is64 value to add
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v +i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic64_add() there.
Return
Nothing.
- s64atomic64_add_return(s64i,atomic64_t*v)¶
atomic add with full ordering
Parameters
s64is64 value to add
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v +i) with full ordering.
Unsafe to use in noinstr code; useraw_atomic64_add_return() there.
Return
The updated value ofv.
- s64atomic64_add_return_acquire(s64i,atomic64_t*v)¶
atomic add with acquire ordering
Parameters
s64is64 value to add
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v +i) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic64_add_return_acquire() there.
Return
The updated value ofv.
- s64atomic64_add_return_release(s64i,atomic64_t*v)¶
atomic add with release ordering
Parameters
s64is64 value to add
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v +i) with release ordering.
Unsafe to use in noinstr code; useraw_atomic64_add_return_release() there.
Return
The updated value ofv.
- s64atomic64_add_return_relaxed(s64i,atomic64_t*v)¶
atomic add with relaxed ordering
Parameters
s64is64 value to add
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v +i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic64_add_return_relaxed() there.
Return
The updated value ofv.
- s64atomic64_fetch_add(s64i,atomic64_t*v)¶
atomic add with full ordering
Parameters
s64is64 value to add
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v +i) with full ordering.
Unsafe to use in noinstr code; useraw_atomic64_fetch_add() there.
Return
The original value ofv.
- s64atomic64_fetch_add_acquire(s64i,atomic64_t*v)¶
atomic add with acquire ordering
Parameters
s64is64 value to add
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v +i) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic64_fetch_add_acquire() there.
Return
The original value ofv.
- s64atomic64_fetch_add_release(s64i,atomic64_t*v)¶
atomic add with release ordering
Parameters
s64is64 value to add
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v +i) with release ordering.
Unsafe to use in noinstr code; useraw_atomic64_fetch_add_release() there.
Return
The original value ofv.
- s64atomic64_fetch_add_relaxed(s64i,atomic64_t*v)¶
atomic add with relaxed ordering
Parameters
s64is64 value to add
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v +i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic64_fetch_add_relaxed() there.
Return
The original value ofv.
- voidatomic64_sub(s64i,atomic64_t*v)¶
atomic subtract with relaxed ordering
Parameters
s64is64 value to subtract
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v -i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic64_sub() there.
Return
Nothing.
- s64atomic64_sub_return(s64i,atomic64_t*v)¶
atomic subtract with full ordering
Parameters
s64is64 value to subtract
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v -i) with full ordering.
Unsafe to use in noinstr code; useraw_atomic64_sub_return() there.
Return
The updated value ofv.
- s64atomic64_sub_return_acquire(s64i,atomic64_t*v)¶
atomic subtract with acquire ordering
Parameters
s64is64 value to subtract
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v -i) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic64_sub_return_acquire() there.
Return
The updated value ofv.
- s64atomic64_sub_return_release(s64i,atomic64_t*v)¶
atomic subtract with release ordering
Parameters
s64is64 value to subtract
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v -i) with release ordering.
Unsafe to use in noinstr code; useraw_atomic64_sub_return_release() there.
Return
The updated value ofv.
- s64atomic64_sub_return_relaxed(s64i,atomic64_t*v)¶
atomic subtract with relaxed ordering
Parameters
s64is64 value to subtract
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v -i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic64_sub_return_relaxed() there.
Return
The updated value ofv.
- s64atomic64_fetch_sub(s64i,atomic64_t*v)¶
atomic subtract with full ordering
Parameters
s64is64 value to subtract
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v -i) with full ordering.
Unsafe to use in noinstr code; useraw_atomic64_fetch_sub() there.
Return
The original value ofv.
- s64atomic64_fetch_sub_acquire(s64i,atomic64_t*v)¶
atomic subtract with acquire ordering
Parameters
s64is64 value to subtract
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v -i) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic64_fetch_sub_acquire() there.
Return
The original value ofv.
- s64atomic64_fetch_sub_release(s64i,atomic64_t*v)¶
atomic subtract with release ordering
Parameters
s64is64 value to subtract
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v -i) with release ordering.
Unsafe to use in noinstr code; useraw_atomic64_fetch_sub_release() there.
Return
The original value ofv.
- s64atomic64_fetch_sub_relaxed(s64i,atomic64_t*v)¶
atomic subtract with relaxed ordering
Parameters
s64is64 value to subtract
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v -i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic64_fetch_sub_relaxed() there.
Return
The original value ofv.
- voidatomic64_inc(atomic64_t*v)¶
atomic increment with relaxed ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v + 1) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic64_inc() there.
Return
Nothing.
- s64atomic64_inc_return(atomic64_t*v)¶
atomic increment with full ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v + 1) with full ordering.
Unsafe to use in noinstr code; useraw_atomic64_inc_return() there.
Return
The updated value ofv.
- s64atomic64_inc_return_acquire(atomic64_t*v)¶
atomic increment with acquire ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v + 1) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic64_inc_return_acquire() there.
Return
The updated value ofv.
- s64atomic64_inc_return_release(atomic64_t*v)¶
atomic increment with release ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v + 1) with release ordering.
Unsafe to use in noinstr code; useraw_atomic64_inc_return_release() there.
Return
The updated value ofv.
- s64atomic64_inc_return_relaxed(atomic64_t*v)¶
atomic increment with relaxed ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v + 1) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic64_inc_return_relaxed() there.
Return
The updated value ofv.
- s64atomic64_fetch_inc(atomic64_t*v)¶
atomic increment with full ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v + 1) with full ordering.
Unsafe to use in noinstr code; useraw_atomic64_fetch_inc() there.
Return
The original value ofv.
- s64atomic64_fetch_inc_acquire(atomic64_t*v)¶
atomic increment with acquire ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v + 1) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic64_fetch_inc_acquire() there.
Return
The original value ofv.
- s64atomic64_fetch_inc_release(atomic64_t*v)¶
atomic increment with release ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v + 1) with release ordering.
Unsafe to use in noinstr code; useraw_atomic64_fetch_inc_release() there.
Return
The original value ofv.
- s64atomic64_fetch_inc_relaxed(atomic64_t*v)¶
atomic increment with relaxed ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v + 1) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic64_fetch_inc_relaxed() there.
Return
The original value ofv.
- voidatomic64_dec(atomic64_t*v)¶
atomic decrement with relaxed ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v - 1) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic64_dec() there.
Return
Nothing.
- s64atomic64_dec_return(atomic64_t*v)¶
atomic decrement with full ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v - 1) with full ordering.
Unsafe to use in noinstr code; useraw_atomic64_dec_return() there.
Return
The updated value ofv.
- s64atomic64_dec_return_acquire(atomic64_t*v)¶
atomic decrement with acquire ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v - 1) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic64_dec_return_acquire() there.
Return
The updated value ofv.
- s64atomic64_dec_return_release(atomic64_t*v)¶
atomic decrement with release ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v - 1) with release ordering.
Unsafe to use in noinstr code; useraw_atomic64_dec_return_release() there.
Return
The updated value ofv.
- s64atomic64_dec_return_relaxed(atomic64_t*v)¶
atomic decrement with relaxed ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v - 1) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic64_dec_return_relaxed() there.
Return
The updated value ofv.
- s64atomic64_fetch_dec(atomic64_t*v)¶
atomic decrement with full ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v - 1) with full ordering.
Unsafe to use in noinstr code; useraw_atomic64_fetch_dec() there.
Return
The original value ofv.
- s64atomic64_fetch_dec_acquire(atomic64_t*v)¶
atomic decrement with acquire ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v - 1) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic64_fetch_dec_acquire() there.
Return
The original value ofv.
- s64atomic64_fetch_dec_release(atomic64_t*v)¶
atomic decrement with release ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v - 1) with release ordering.
Unsafe to use in noinstr code; useraw_atomic64_fetch_dec_release() there.
Return
The original value ofv.
- s64atomic64_fetch_dec_relaxed(atomic64_t*v)¶
atomic decrement with relaxed ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v - 1) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic64_fetch_dec_relaxed() there.
Return
The original value ofv.
- voidatomic64_and(s64i,atomic64_t*v)¶
atomic bitwise AND with relaxed ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v &i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic64_and() there.
Return
Nothing.
- s64atomic64_fetch_and(s64i,atomic64_t*v)¶
atomic bitwise AND with full ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v &i) with full ordering.
Unsafe to use in noinstr code; useraw_atomic64_fetch_and() there.
Return
The original value ofv.
- s64atomic64_fetch_and_acquire(s64i,atomic64_t*v)¶
atomic bitwise AND with acquire ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v &i) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic64_fetch_and_acquire() there.
Return
The original value ofv.
- s64atomic64_fetch_and_release(s64i,atomic64_t*v)¶
atomic bitwise AND with release ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v &i) with release ordering.
Unsafe to use in noinstr code; useraw_atomic64_fetch_and_release() there.
Return
The original value ofv.
- s64atomic64_fetch_and_relaxed(s64i,atomic64_t*v)¶
atomic bitwise AND with relaxed ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v &i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic64_fetch_and_relaxed() there.
Return
The original value ofv.
- voidatomic64_andnot(s64i,atomic64_t*v)¶
atomic bitwise AND NOT with relaxed ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v &~i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic64_andnot() there.
Return
Nothing.
- s64atomic64_fetch_andnot(s64i,atomic64_t*v)¶
atomic bitwise AND NOT with full ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v &~i) with full ordering.
Unsafe to use in noinstr code; useraw_atomic64_fetch_andnot() there.
Return
The original value ofv.
- s64atomic64_fetch_andnot_acquire(s64i,atomic64_t*v)¶
atomic bitwise AND NOT with acquire ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v &~i) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic64_fetch_andnot_acquire() there.
Return
The original value ofv.
- s64atomic64_fetch_andnot_release(s64i,atomic64_t*v)¶
atomic bitwise AND NOT with release ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v &~i) with release ordering.
Unsafe to use in noinstr code; useraw_atomic64_fetch_andnot_release() there.
Return
The original value ofv.
- s64atomic64_fetch_andnot_relaxed(s64i,atomic64_t*v)¶
atomic bitwise AND NOT with relaxed ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v &~i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic64_fetch_andnot_relaxed() there.
Return
The original value ofv.
- voidatomic64_or(s64i,atomic64_t*v)¶
atomic bitwise OR with relaxed ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v |i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic64_or() there.
Return
Nothing.
- s64atomic64_fetch_or(s64i,atomic64_t*v)¶
atomic bitwise OR with full ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v |i) with full ordering.
Unsafe to use in noinstr code; useraw_atomic64_fetch_or() there.
Return
The original value ofv.
- s64atomic64_fetch_or_acquire(s64i,atomic64_t*v)¶
atomic bitwise OR with acquire ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v |i) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic64_fetch_or_acquire() there.
Return
The original value ofv.
- s64atomic64_fetch_or_release(s64i,atomic64_t*v)¶
atomic bitwise OR with release ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v |i) with release ordering.
Unsafe to use in noinstr code; useraw_atomic64_fetch_or_release() there.
Return
The original value ofv.
- s64atomic64_fetch_or_relaxed(s64i,atomic64_t*v)¶
atomic bitwise OR with relaxed ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v |i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic64_fetch_or_relaxed() there.
Return
The original value ofv.
- voidatomic64_xor(s64i,atomic64_t*v)¶
atomic bitwise XOR with relaxed ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v ^i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic64_xor() there.
Return
Nothing.
- s64atomic64_fetch_xor(s64i,atomic64_t*v)¶
atomic bitwise XOR with full ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v ^i) with full ordering.
Unsafe to use in noinstr code; useraw_atomic64_fetch_xor() there.
Return
The original value ofv.
- s64atomic64_fetch_xor_acquire(s64i,atomic64_t*v)¶
atomic bitwise XOR with acquire ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v ^i) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic64_fetch_xor_acquire() there.
Return
The original value ofv.
- s64atomic64_fetch_xor_release(s64i,atomic64_t*v)¶
atomic bitwise XOR with release ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v ^i) with release ordering.
Unsafe to use in noinstr code; useraw_atomic64_fetch_xor_release() there.
Return
The original value ofv.
- s64atomic64_fetch_xor_relaxed(s64i,atomic64_t*v)¶
atomic bitwise XOR with relaxed ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v ^i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic64_fetch_xor_relaxed() there.
Return
The original value ofv.
- s64atomic64_xchg(atomic64_t*v,s64new)¶
atomic exchange with full ordering
Parameters
atomic64_t*vpointer to atomic64_t
s64news64 value to assign
Description
Atomically updatesv tonew with full ordering.
Unsafe to use in noinstr code; useraw_atomic64_xchg() there.
Return
The original value ofv.
- s64atomic64_xchg_acquire(atomic64_t*v,s64new)¶
atomic exchange with acquire ordering
Parameters
atomic64_t*vpointer to atomic64_t
s64news64 value to assign
Description
Atomically updatesv tonew with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic64_xchg_acquire() there.
Return
The original value ofv.
- s64atomic64_xchg_release(atomic64_t*v,s64new)¶
atomic exchange with release ordering
Parameters
atomic64_t*vpointer to atomic64_t
s64news64 value to assign
Description
Atomically updatesv tonew with release ordering.
Unsafe to use in noinstr code; useraw_atomic64_xchg_release() there.
Return
The original value ofv.
- s64atomic64_xchg_relaxed(atomic64_t*v,s64new)¶
atomic exchange with relaxed ordering
Parameters
atomic64_t*vpointer to atomic64_t
s64news64 value to assign
Description
Atomically updatesv tonew with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic64_xchg_relaxed() there.
Return
The original value ofv.
- s64atomic64_cmpxchg(atomic64_t*v,s64old,s64new)¶
atomic compare and exchange with full ordering
Parameters
atomic64_t*vpointer to atomic64_t
s64olds64 value to compare with
s64news64 value to assign
Description
If (v ==old), atomically updatesv tonew with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic64_cmpxchg() there.
Return
The original value ofv.
- s64atomic64_cmpxchg_acquire(atomic64_t*v,s64old,s64new)¶
atomic compare and exchange with acquire ordering
Parameters
atomic64_t*vpointer to atomic64_t
s64olds64 value to compare with
s64news64 value to assign
Description
If (v ==old), atomically updatesv tonew with acquire ordering.Otherwise,v is not modified and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic64_cmpxchg_acquire() there.
Return
The original value ofv.
- s64atomic64_cmpxchg_release(atomic64_t*v,s64old,s64new)¶
atomic compare and exchange with release ordering
Parameters
atomic64_t*vpointer to atomic64_t
s64olds64 value to compare with
s64news64 value to assign
Description
If (v ==old), atomically updatesv tonew with release ordering.Otherwise,v is not modified and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic64_cmpxchg_release() there.
Return
The original value ofv.
- s64atomic64_cmpxchg_relaxed(atomic64_t*v,s64old,s64new)¶
atomic compare and exchange with relaxed ordering
Parameters
atomic64_t*vpointer to atomic64_t
s64olds64 value to compare with
s64news64 value to assign
Description
If (v ==old), atomically updatesv tonew with relaxed ordering.Otherwise,v is not modified and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic64_cmpxchg_relaxed() there.
Return
The original value ofv.
- boolatomic64_try_cmpxchg(atomic64_t*v,s64*old,s64new)¶
atomic compare and exchange with full ordering
Parameters
atomic64_t*vpointer to atomic64_t
s64*oldpointer to s64 value to compare with
s64news64 value to assign
Description
If (v ==old), atomically updatesv tonew with full ordering.Otherwise,v is not modified,old is updated to the current value ofv,and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic64_try_cmpxchg() there.
Return
true if the exchange occured,false otherwise.
- boolatomic64_try_cmpxchg_acquire(atomic64_t*v,s64*old,s64new)¶
atomic compare and exchange with acquire ordering
Parameters
atomic64_t*vpointer to atomic64_t
s64*oldpointer to s64 value to compare with
s64news64 value to assign
Description
If (v ==old), atomically updatesv tonew with acquire ordering.Otherwise,v is not modified,old is updated to the current value ofv,and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic64_try_cmpxchg_acquire() there.
Return
true if the exchange occured,false otherwise.
- boolatomic64_try_cmpxchg_release(atomic64_t*v,s64*old,s64new)¶
atomic compare and exchange with release ordering
Parameters
atomic64_t*vpointer to atomic64_t
s64*oldpointer to s64 value to compare with
s64news64 value to assign
Description
If (v ==old), atomically updatesv tonew with release ordering.Otherwise,v is not modified,old is updated to the current value ofv,and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic64_try_cmpxchg_release() there.
Return
true if the exchange occured,false otherwise.
- boolatomic64_try_cmpxchg_relaxed(atomic64_t*v,s64*old,s64new)¶
atomic compare and exchange with relaxed ordering
Parameters
atomic64_t*vpointer to atomic64_t
s64*oldpointer to s64 value to compare with
s64news64 value to assign
Description
If (v ==old), atomically updatesv tonew with relaxed ordering.Otherwise,v is not modified,old is updated to the current value ofv,and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic64_try_cmpxchg_relaxed() there.
Return
true if the exchange occured,false otherwise.
- boolatomic64_sub_and_test(s64i,atomic64_t*v)¶
atomic subtract and test if zero with full ordering
Parameters
s64is64 value to subtract
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v -i) with full ordering.
Unsafe to use in noinstr code; useraw_atomic64_sub_and_test() there.
Return
true if the resulting value ofv is zero,false otherwise.
- boolatomic64_dec_and_test(atomic64_t*v)¶
atomic decrement and test if zero with full ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v - 1) with full ordering.
Unsafe to use in noinstr code; useraw_atomic64_dec_and_test() there.
Return
true if the resulting value ofv is zero,false otherwise.
- boolatomic64_inc_and_test(atomic64_t*v)¶
atomic increment and test if zero with full ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v + 1) with full ordering.
Unsafe to use in noinstr code; useraw_atomic64_inc_and_test() there.
Return
true if the resulting value ofv is zero,false otherwise.
- boolatomic64_add_negative(s64i,atomic64_t*v)¶
atomic add and test if negative with full ordering
Parameters
s64is64 value to add
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v +i) with full ordering.
Unsafe to use in noinstr code; useraw_atomic64_add_negative() there.
Return
true if the resulting value ofv is negative,false otherwise.
- boolatomic64_add_negative_acquire(s64i,atomic64_t*v)¶
atomic add and test if negative with acquire ordering
Parameters
s64is64 value to add
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v +i) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic64_add_negative_acquire() there.
Return
true if the resulting value ofv is negative,false otherwise.
- boolatomic64_add_negative_release(s64i,atomic64_t*v)¶
atomic add and test if negative with release ordering
Parameters
s64is64 value to add
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v +i) with release ordering.
Unsafe to use in noinstr code; useraw_atomic64_add_negative_release() there.
Return
true if the resulting value ofv is negative,false otherwise.
- boolatomic64_add_negative_relaxed(s64i,atomic64_t*v)¶
atomic add and test if negative with relaxed ordering
Parameters
s64is64 value to add
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v +i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic64_add_negative_relaxed() there.
Return
true if the resulting value ofv is negative,false otherwise.
- s64atomic64_fetch_add_unless(atomic64_t*v,s64a,s64u)¶
atomic add unless value with full ordering
Parameters
atomic64_t*vpointer to atomic64_t
s64as64 value to add
s64us64 value to compare with
Description
If (v !=u), atomically updatesv to (v +a) with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic64_fetch_add_unless() there.
Return
The original value ofv.
- boolatomic64_add_unless(atomic64_t*v,s64a,s64u)¶
atomic add unless value with full ordering
Parameters
atomic64_t*vpointer to atomic64_t
s64as64 value to add
s64us64 value to compare with
Description
If (v !=u), atomically updatesv to (v +a) with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic64_add_unless() there.
Return
true ifv was updated,false otherwise.
- boolatomic64_inc_not_zero(atomic64_t*v)¶
atomic increment unless zero with full ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
If (v != 0), atomically updatesv to (v + 1) with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic64_inc_not_zero() there.
Return
true ifv was updated,false otherwise.
- boolatomic64_inc_unless_negative(atomic64_t*v)¶
atomic increment unless negative with full ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
If (v >= 0), atomically updatesv to (v + 1) with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic64_inc_unless_negative() there.
Return
true ifv was updated,false otherwise.
- boolatomic64_dec_unless_positive(atomic64_t*v)¶
atomic decrement unless positive with full ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
If (v <= 0), atomically updatesv to (v - 1) with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic64_dec_unless_positive() there.
Return
true ifv was updated,false otherwise.
- s64atomic64_dec_if_positive(atomic64_t*v)¶
atomic decrement if positive with full ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
If (v > 0), atomically updatesv to (v - 1) with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic64_dec_if_positive() there.
Return
The old value of (v - 1), regardless of whetherv was updated.
- longatomic_long_read(constatomic_long_t*v)¶
atomic load with relaxed ordering
Parameters
constatomic_long_t*vpointer to atomic_long_t
Description
Atomically loads the value ofv with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_long_read() there.
Return
The value loaded fromv.
- longatomic_long_read_acquire(constatomic_long_t*v)¶
atomic load with acquire ordering
Parameters
constatomic_long_t*vpointer to atomic_long_t
Description
Atomically loads the value ofv with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic_long_read_acquire() there.
Return
The value loaded fromv.
- voidatomic_long_set(atomic_long_t*v,longi)¶
atomic set with relaxed ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
longilong value to assign
Description
Atomically setsv toi with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_long_set() there.
Return
Nothing.
- voidatomic_long_set_release(atomic_long_t*v,longi)¶
atomic set with release ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
longilong value to assign
Description
Atomically setsv toi with release ordering.
Unsafe to use in noinstr code; useraw_atomic_long_set_release() there.
Return
Nothing.
- voidatomic_long_add(longi,atomic_long_t*v)¶
atomic add with relaxed ordering
Parameters
longilong value to add
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v +i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_long_add() there.
Return
Nothing.
- longatomic_long_add_return(longi,atomic_long_t*v)¶
atomic add with full ordering
Parameters
longilong value to add
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v +i) with full ordering.
Unsafe to use in noinstr code; useraw_atomic_long_add_return() there.
Return
The updated value ofv.
- longatomic_long_add_return_acquire(longi,atomic_long_t*v)¶
atomic add with acquire ordering
Parameters
longilong value to add
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v +i) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic_long_add_return_acquire() there.
Return
The updated value ofv.
- longatomic_long_add_return_release(longi,atomic_long_t*v)¶
atomic add with release ordering
Parameters
longilong value to add
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v +i) with release ordering.
Unsafe to use in noinstr code; useraw_atomic_long_add_return_release() there.
Return
The updated value ofv.
- longatomic_long_add_return_relaxed(longi,atomic_long_t*v)¶
atomic add with relaxed ordering
Parameters
longilong value to add
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v +i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_long_add_return_relaxed() there.
Return
The updated value ofv.
- longatomic_long_fetch_add(longi,atomic_long_t*v)¶
atomic add with full ordering
Parameters
longilong value to add
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v +i) with full ordering.
Unsafe to use in noinstr code; useraw_atomic_long_fetch_add() there.
Return
The original value ofv.
- longatomic_long_fetch_add_acquire(longi,atomic_long_t*v)¶
atomic add with acquire ordering
Parameters
longilong value to add
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v +i) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic_long_fetch_add_acquire() there.
Return
The original value ofv.
- longatomic_long_fetch_add_release(longi,atomic_long_t*v)¶
atomic add with release ordering
Parameters
longilong value to add
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v +i) with release ordering.
Unsafe to use in noinstr code; useraw_atomic_long_fetch_add_release() there.
Return
The original value ofv.
- longatomic_long_fetch_add_relaxed(longi,atomic_long_t*v)¶
atomic add with relaxed ordering
Parameters
longilong value to add
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v +i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_long_fetch_add_relaxed() there.
Return
The original value ofv.
- voidatomic_long_sub(longi,atomic_long_t*v)¶
atomic subtract with relaxed ordering
Parameters
longilong value to subtract
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v -i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_long_sub() there.
Return
Nothing.
- longatomic_long_sub_return(longi,atomic_long_t*v)¶
atomic subtract with full ordering
Parameters
longilong value to subtract
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v -i) with full ordering.
Unsafe to use in noinstr code; useraw_atomic_long_sub_return() there.
Return
The updated value ofv.
- longatomic_long_sub_return_acquire(longi,atomic_long_t*v)¶
atomic subtract with acquire ordering
Parameters
longilong value to subtract
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v -i) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic_long_sub_return_acquire() there.
Return
The updated value ofv.
- longatomic_long_sub_return_release(longi,atomic_long_t*v)¶
atomic subtract with release ordering
Parameters
longilong value to subtract
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v -i) with release ordering.
Unsafe to use in noinstr code; useraw_atomic_long_sub_return_release() there.
Return
The updated value ofv.
- longatomic_long_sub_return_relaxed(longi,atomic_long_t*v)¶
atomic subtract with relaxed ordering
Parameters
longilong value to subtract
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v -i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_long_sub_return_relaxed() there.
Return
The updated value ofv.
- longatomic_long_fetch_sub(longi,atomic_long_t*v)¶
atomic subtract with full ordering
Parameters
longilong value to subtract
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v -i) with full ordering.
Unsafe to use in noinstr code; useraw_atomic_long_fetch_sub() there.
Return
The original value ofv.
- longatomic_long_fetch_sub_acquire(longi,atomic_long_t*v)¶
atomic subtract with acquire ordering
Parameters
longilong value to subtract
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v -i) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic_long_fetch_sub_acquire() there.
Return
The original value ofv.
- longatomic_long_fetch_sub_release(longi,atomic_long_t*v)¶
atomic subtract with release ordering
Parameters
longilong value to subtract
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v -i) with release ordering.
Unsafe to use in noinstr code; useraw_atomic_long_fetch_sub_release() there.
Return
The original value ofv.
- longatomic_long_fetch_sub_relaxed(longi,atomic_long_t*v)¶
atomic subtract with relaxed ordering
Parameters
longilong value to subtract
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v -i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_long_fetch_sub_relaxed() there.
Return
The original value ofv.
- voidatomic_long_inc(atomic_long_t*v)¶
atomic increment with relaxed ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v + 1) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_long_inc() there.
Return
Nothing.
- longatomic_long_inc_return(atomic_long_t*v)¶
atomic increment with full ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v + 1) with full ordering.
Unsafe to use in noinstr code; useraw_atomic_long_inc_return() there.
Return
The updated value ofv.
- longatomic_long_inc_return_acquire(atomic_long_t*v)¶
atomic increment with acquire ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v + 1) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic_long_inc_return_acquire() there.
Return
The updated value ofv.
- longatomic_long_inc_return_release(atomic_long_t*v)¶
atomic increment with release ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v + 1) with release ordering.
Unsafe to use in noinstr code; useraw_atomic_long_inc_return_release() there.
Return
The updated value ofv.
- longatomic_long_inc_return_relaxed(atomic_long_t*v)¶
atomic increment with relaxed ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v + 1) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_long_inc_return_relaxed() there.
Return
The updated value ofv.
- longatomic_long_fetch_inc(atomic_long_t*v)¶
atomic increment with full ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v + 1) with full ordering.
Unsafe to use in noinstr code; useraw_atomic_long_fetch_inc() there.
Return
The original value ofv.
- longatomic_long_fetch_inc_acquire(atomic_long_t*v)¶
atomic increment with acquire ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v + 1) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic_long_fetch_inc_acquire() there.
Return
The original value ofv.
- longatomic_long_fetch_inc_release(atomic_long_t*v)¶
atomic increment with release ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v + 1) with release ordering.
Unsafe to use in noinstr code; useraw_atomic_long_fetch_inc_release() there.
Return
The original value ofv.
- longatomic_long_fetch_inc_relaxed(atomic_long_t*v)¶
atomic increment with relaxed ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v + 1) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_long_fetch_inc_relaxed() there.
Return
The original value ofv.
- voidatomic_long_dec(atomic_long_t*v)¶
atomic decrement with relaxed ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v - 1) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_long_dec() there.
Return
Nothing.
- longatomic_long_dec_return(atomic_long_t*v)¶
atomic decrement with full ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v - 1) with full ordering.
Unsafe to use in noinstr code; useraw_atomic_long_dec_return() there.
Return
The updated value ofv.
- longatomic_long_dec_return_acquire(atomic_long_t*v)¶
atomic decrement with acquire ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v - 1) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic_long_dec_return_acquire() there.
Return
The updated value ofv.
- longatomic_long_dec_return_release(atomic_long_t*v)¶
atomic decrement with release ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v - 1) with release ordering.
Unsafe to use in noinstr code; useraw_atomic_long_dec_return_release() there.
Return
The updated value ofv.
- longatomic_long_dec_return_relaxed(atomic_long_t*v)¶
atomic decrement with relaxed ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v - 1) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_long_dec_return_relaxed() there.
Return
The updated value ofv.
- longatomic_long_fetch_dec(atomic_long_t*v)¶
atomic decrement with full ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v - 1) with full ordering.
Unsafe to use in noinstr code; useraw_atomic_long_fetch_dec() there.
Return
The original value ofv.
- longatomic_long_fetch_dec_acquire(atomic_long_t*v)¶
atomic decrement with acquire ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v - 1) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic_long_fetch_dec_acquire() there.
Return
The original value ofv.
- longatomic_long_fetch_dec_release(atomic_long_t*v)¶
atomic decrement with release ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v - 1) with release ordering.
Unsafe to use in noinstr code; useraw_atomic_long_fetch_dec_release() there.
Return
The original value ofv.
- longatomic_long_fetch_dec_relaxed(atomic_long_t*v)¶
atomic decrement with relaxed ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v - 1) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_long_fetch_dec_relaxed() there.
Return
The original value ofv.
- voidatomic_long_and(longi,atomic_long_t*v)¶
atomic bitwise AND with relaxed ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v &i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_long_and() there.
Return
Nothing.
- longatomic_long_fetch_and(longi,atomic_long_t*v)¶
atomic bitwise AND with full ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v &i) with full ordering.
Unsafe to use in noinstr code; useraw_atomic_long_fetch_and() there.
Return
The original value ofv.
- longatomic_long_fetch_and_acquire(longi,atomic_long_t*v)¶
atomic bitwise AND with acquire ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v &i) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic_long_fetch_and_acquire() there.
Return
The original value ofv.
- longatomic_long_fetch_and_release(longi,atomic_long_t*v)¶
atomic bitwise AND with release ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v &i) with release ordering.
Unsafe to use in noinstr code; useraw_atomic_long_fetch_and_release() there.
Return
The original value ofv.
- longatomic_long_fetch_and_relaxed(longi,atomic_long_t*v)¶
atomic bitwise AND with relaxed ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v &i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_long_fetch_and_relaxed() there.
Return
The original value ofv.
- voidatomic_long_andnot(longi,atomic_long_t*v)¶
atomic bitwise AND NOT with relaxed ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v &~i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_long_andnot() there.
Return
Nothing.
- longatomic_long_fetch_andnot(longi,atomic_long_t*v)¶
atomic bitwise AND NOT with full ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v &~i) with full ordering.
Unsafe to use in noinstr code; useraw_atomic_long_fetch_andnot() there.
Return
The original value ofv.
- longatomic_long_fetch_andnot_acquire(longi,atomic_long_t*v)¶
atomic bitwise AND NOT with acquire ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v &~i) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic_long_fetch_andnot_acquire() there.
Return
The original value ofv.
- longatomic_long_fetch_andnot_release(longi,atomic_long_t*v)¶
atomic bitwise AND NOT with release ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v &~i) with release ordering.
Unsafe to use in noinstr code; useraw_atomic_long_fetch_andnot_release() there.
Return
The original value ofv.
- longatomic_long_fetch_andnot_relaxed(longi,atomic_long_t*v)¶
atomic bitwise AND NOT with relaxed ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v &~i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_long_fetch_andnot_relaxed() there.
Return
The original value ofv.
- voidatomic_long_or(longi,atomic_long_t*v)¶
atomic bitwise OR with relaxed ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v |i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_long_or() there.
Return
Nothing.
- longatomic_long_fetch_or(longi,atomic_long_t*v)¶
atomic bitwise OR with full ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v |i) with full ordering.
Unsafe to use in noinstr code; useraw_atomic_long_fetch_or() there.
Return
The original value ofv.
- longatomic_long_fetch_or_acquire(longi,atomic_long_t*v)¶
atomic bitwise OR with acquire ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v |i) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic_long_fetch_or_acquire() there.
Return
The original value ofv.
- longatomic_long_fetch_or_release(longi,atomic_long_t*v)¶
atomic bitwise OR with release ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v |i) with release ordering.
Unsafe to use in noinstr code; useraw_atomic_long_fetch_or_release() there.
Return
The original value ofv.
- longatomic_long_fetch_or_relaxed(longi,atomic_long_t*v)¶
atomic bitwise OR with relaxed ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v |i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_long_fetch_or_relaxed() there.
Return
The original value ofv.
- voidatomic_long_xor(longi,atomic_long_t*v)¶
atomic bitwise XOR with relaxed ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v ^i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_long_xor() there.
Return
Nothing.
- longatomic_long_fetch_xor(longi,atomic_long_t*v)¶
atomic bitwise XOR with full ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v ^i) with full ordering.
Unsafe to use in noinstr code; useraw_atomic_long_fetch_xor() there.
Return
The original value ofv.
- longatomic_long_fetch_xor_acquire(longi,atomic_long_t*v)¶
atomic bitwise XOR with acquire ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v ^i) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic_long_fetch_xor_acquire() there.
Return
The original value ofv.
- longatomic_long_fetch_xor_release(longi,atomic_long_t*v)¶
atomic bitwise XOR with release ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v ^i) with release ordering.
Unsafe to use in noinstr code; useraw_atomic_long_fetch_xor_release() there.
Return
The original value ofv.
- longatomic_long_fetch_xor_relaxed(longi,atomic_long_t*v)¶
atomic bitwise XOR with relaxed ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v ^i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_long_fetch_xor_relaxed() there.
Return
The original value ofv.
- longatomic_long_xchg(atomic_long_t*v,longnew)¶
atomic exchange with full ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
longnewlong value to assign
Description
Atomically updatesv tonew with full ordering.
Unsafe to use in noinstr code; useraw_atomic_long_xchg() there.
Return
The original value ofv.
- longatomic_long_xchg_acquire(atomic_long_t*v,longnew)¶
atomic exchange with acquire ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
longnewlong value to assign
Description
Atomically updatesv tonew with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic_long_xchg_acquire() there.
Return
The original value ofv.
- longatomic_long_xchg_release(atomic_long_t*v,longnew)¶
atomic exchange with release ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
longnewlong value to assign
Description
Atomically updatesv tonew with release ordering.
Unsafe to use in noinstr code; useraw_atomic_long_xchg_release() there.
Return
The original value ofv.
- longatomic_long_xchg_relaxed(atomic_long_t*v,longnew)¶
atomic exchange with relaxed ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
longnewlong value to assign
Description
Atomically updatesv tonew with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_long_xchg_relaxed() there.
Return
The original value ofv.
- longatomic_long_cmpxchg(atomic_long_t*v,longold,longnew)¶
atomic compare and exchange with full ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
longoldlong value to compare with
longnewlong value to assign
Description
If (v ==old), atomically updatesv tonew with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic_long_cmpxchg() there.
Return
The original value ofv.
- longatomic_long_cmpxchg_acquire(atomic_long_t*v,longold,longnew)¶
atomic compare and exchange with acquire ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
longoldlong value to compare with
longnewlong value to assign
Description
If (v ==old), atomically updatesv tonew with acquire ordering.Otherwise,v is not modified and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic_long_cmpxchg_acquire() there.
Return
The original value ofv.
- longatomic_long_cmpxchg_release(atomic_long_t*v,longold,longnew)¶
atomic compare and exchange with release ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
longoldlong value to compare with
longnewlong value to assign
Description
If (v ==old), atomically updatesv tonew with release ordering.Otherwise,v is not modified and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic_long_cmpxchg_release() there.
Return
The original value ofv.
- longatomic_long_cmpxchg_relaxed(atomic_long_t*v,longold,longnew)¶
atomic compare and exchange with relaxed ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
longoldlong value to compare with
longnewlong value to assign
Description
If (v ==old), atomically updatesv tonew with relaxed ordering.Otherwise,v is not modified and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic_long_cmpxchg_relaxed() there.
Return
The original value ofv.
- boolatomic_long_try_cmpxchg(atomic_long_t*v,long*old,longnew)¶
atomic compare and exchange with full ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
long*oldpointer to long value to compare with
longnewlong value to assign
Description
If (v ==old), atomically updatesv tonew with full ordering.Otherwise,v is not modified,old is updated to the current value ofv,and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic_long_try_cmpxchg() there.
Return
true if the exchange occured,false otherwise.
- boolatomic_long_try_cmpxchg_acquire(atomic_long_t*v,long*old,longnew)¶
atomic compare and exchange with acquire ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
long*oldpointer to long value to compare with
longnewlong value to assign
Description
If (v ==old), atomically updatesv tonew with acquire ordering.Otherwise,v is not modified,old is updated to the current value ofv,and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic_long_try_cmpxchg_acquire() there.
Return
true if the exchange occured,false otherwise.
- boolatomic_long_try_cmpxchg_release(atomic_long_t*v,long*old,longnew)¶
atomic compare and exchange with release ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
long*oldpointer to long value to compare with
longnewlong value to assign
Description
If (v ==old), atomically updatesv tonew with release ordering.Otherwise,v is not modified,old is updated to the current value ofv,and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic_long_try_cmpxchg_release() there.
Return
true if the exchange occured,false otherwise.
- boolatomic_long_try_cmpxchg_relaxed(atomic_long_t*v,long*old,longnew)¶
atomic compare and exchange with relaxed ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
long*oldpointer to long value to compare with
longnewlong value to assign
Description
If (v ==old), atomically updatesv tonew with relaxed ordering.Otherwise,v is not modified,old is updated to the current value ofv,and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic_long_try_cmpxchg_relaxed() there.
Return
true if the exchange occured,false otherwise.
- boolatomic_long_sub_and_test(longi,atomic_long_t*v)¶
atomic subtract and test if zero with full ordering
Parameters
longilong value to subtract
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v -i) with full ordering.
Unsafe to use in noinstr code; useraw_atomic_long_sub_and_test() there.
Return
true if the resulting value ofv is zero,false otherwise.
- boolatomic_long_dec_and_test(atomic_long_t*v)¶
atomic decrement and test if zero with full ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v - 1) with full ordering.
Unsafe to use in noinstr code; useraw_atomic_long_dec_and_test() there.
Return
true if the resulting value ofv is zero,false otherwise.
- boolatomic_long_inc_and_test(atomic_long_t*v)¶
atomic increment and test if zero with full ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v + 1) with full ordering.
Unsafe to use in noinstr code; useraw_atomic_long_inc_and_test() there.
Return
true if the resulting value ofv is zero,false otherwise.
- boolatomic_long_add_negative(longi,atomic_long_t*v)¶
atomic add and test if negative with full ordering
Parameters
longilong value to add
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v +i) with full ordering.
Unsafe to use in noinstr code; useraw_atomic_long_add_negative() there.
Return
true if the resulting value ofv is negative,false otherwise.
- boolatomic_long_add_negative_acquire(longi,atomic_long_t*v)¶
atomic add and test if negative with acquire ordering
Parameters
longilong value to add
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v +i) with acquire ordering.
Unsafe to use in noinstr code; useraw_atomic_long_add_negative_acquire() there.
Return
true if the resulting value ofv is negative,false otherwise.
- boolatomic_long_add_negative_release(longi,atomic_long_t*v)¶
atomic add and test if negative with release ordering
Parameters
longilong value to add
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v +i) with release ordering.
Unsafe to use in noinstr code; useraw_atomic_long_add_negative_release() there.
Return
true if the resulting value ofv is negative,false otherwise.
- boolatomic_long_add_negative_relaxed(longi,atomic_long_t*v)¶
atomic add and test if negative with relaxed ordering
Parameters
longilong value to add
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v +i) with relaxed ordering.
Unsafe to use in noinstr code; useraw_atomic_long_add_negative_relaxed() there.
Return
true if the resulting value ofv is negative,false otherwise.
- longatomic_long_fetch_add_unless(atomic_long_t*v,longa,longu)¶
atomic add unless value with full ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
longalong value to add
longulong value to compare with
Description
If (v !=u), atomically updatesv to (v +a) with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic_long_fetch_add_unless() there.
Return
The original value ofv.
- boolatomic_long_add_unless(atomic_long_t*v,longa,longu)¶
atomic add unless value with full ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
longalong value to add
longulong value to compare with
Description
If (v !=u), atomically updatesv to (v +a) with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic_long_add_unless() there.
Return
true ifv was updated,false otherwise.
- boolatomic_long_inc_not_zero(atomic_long_t*v)¶
atomic increment unless zero with full ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
If (v != 0), atomically updatesv to (v + 1) with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic_long_inc_not_zero() there.
Return
true ifv was updated,false otherwise.
- boolatomic_long_inc_unless_negative(atomic_long_t*v)¶
atomic increment unless negative with full ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
If (v >= 0), atomically updatesv to (v + 1) with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic_long_inc_unless_negative() there.
Return
true ifv was updated,false otherwise.
- boolatomic_long_dec_unless_positive(atomic_long_t*v)¶
atomic decrement unless positive with full ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
If (v <= 0), atomically updatesv to (v - 1) with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic_long_dec_unless_positive() there.
Return
true ifv was updated,false otherwise.
- longatomic_long_dec_if_positive(atomic_long_t*v)¶
atomic decrement if positive with full ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
If (v > 0), atomically updatesv to (v - 1) with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Unsafe to use in noinstr code; useraw_atomic_long_dec_if_positive() there.
Return
The old value of (v - 1), regardless of whetherv was updated.
- intraw_atomic_read(constatomic_t*v)¶
atomic load with relaxed ordering
Parameters
constatomic_t*vpointer to atomic_t
Description
Atomically loads the value ofv with relaxed ordering.
Safe to use in noinstr code; preferatomic_read() elsewhere.
Return
The value loaded fromv.
- intraw_atomic_read_acquire(constatomic_t*v)¶
atomic load with acquire ordering
Parameters
constatomic_t*vpointer to atomic_t
Description
Atomically loads the value ofv with acquire ordering.
Safe to use in noinstr code; preferatomic_read_acquire() elsewhere.
Return
The value loaded fromv.
- voidraw_atomic_set(atomic_t*v,inti)¶
atomic set with relaxed ordering
Parameters
atomic_t*vpointer to atomic_t
intiint value to assign
Description
Atomically setsv toi with relaxed ordering.
Safe to use in noinstr code; preferatomic_set() elsewhere.
Return
Nothing.
- voidraw_atomic_set_release(atomic_t*v,inti)¶
atomic set with release ordering
Parameters
atomic_t*vpointer to atomic_t
intiint value to assign
Description
Atomically setsv toi with release ordering.
Safe to use in noinstr code; preferatomic_set_release() elsewhere.
Return
Nothing.
- voidraw_atomic_add(inti,atomic_t*v)¶
atomic add with relaxed ordering
Parameters
intiint value to add
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v +i) with relaxed ordering.
Safe to use in noinstr code; preferatomic_add() elsewhere.
Return
Nothing.
- intraw_atomic_add_return(inti,atomic_t*v)¶
atomic add with full ordering
Parameters
intiint value to add
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v +i) with full ordering.
Safe to use in noinstr code; preferatomic_add_return() elsewhere.
Return
The updated value ofv.
- intraw_atomic_add_return_acquire(inti,atomic_t*v)¶
atomic add with acquire ordering
Parameters
intiint value to add
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v +i) with acquire ordering.
Safe to use in noinstr code; preferatomic_add_return_acquire() elsewhere.
Return
The updated value ofv.
- intraw_atomic_add_return_release(inti,atomic_t*v)¶
atomic add with release ordering
Parameters
intiint value to add
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v +i) with release ordering.
Safe to use in noinstr code; preferatomic_add_return_release() elsewhere.
Return
The updated value ofv.
- intraw_atomic_add_return_relaxed(inti,atomic_t*v)¶
atomic add with relaxed ordering
Parameters
intiint value to add
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v +i) with relaxed ordering.
Safe to use in noinstr code; preferatomic_add_return_relaxed() elsewhere.
Return
The updated value ofv.
- intraw_atomic_fetch_add(inti,atomic_t*v)¶
atomic add with full ordering
Parameters
intiint value to add
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v +i) with full ordering.
Safe to use in noinstr code; preferatomic_fetch_add() elsewhere.
Return
The original value ofv.
- intraw_atomic_fetch_add_acquire(inti,atomic_t*v)¶
atomic add with acquire ordering
Parameters
intiint value to add
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v +i) with acquire ordering.
Safe to use in noinstr code; preferatomic_fetch_add_acquire() elsewhere.
Return
The original value ofv.
- intraw_atomic_fetch_add_release(inti,atomic_t*v)¶
atomic add with release ordering
Parameters
intiint value to add
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v +i) with release ordering.
Safe to use in noinstr code; preferatomic_fetch_add_release() elsewhere.
Return
The original value ofv.
- intraw_atomic_fetch_add_relaxed(inti,atomic_t*v)¶
atomic add with relaxed ordering
Parameters
intiint value to add
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v +i) with relaxed ordering.
Safe to use in noinstr code; preferatomic_fetch_add_relaxed() elsewhere.
Return
The original value ofv.
- voidraw_atomic_sub(inti,atomic_t*v)¶
atomic subtract with relaxed ordering
Parameters
intiint value to subtract
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v -i) with relaxed ordering.
Safe to use in noinstr code; preferatomic_sub() elsewhere.
Return
Nothing.
- intraw_atomic_sub_return(inti,atomic_t*v)¶
atomic subtract with full ordering
Parameters
intiint value to subtract
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v -i) with full ordering.
Safe to use in noinstr code; preferatomic_sub_return() elsewhere.
Return
The updated value ofv.
- intraw_atomic_sub_return_acquire(inti,atomic_t*v)¶
atomic subtract with acquire ordering
Parameters
intiint value to subtract
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v -i) with acquire ordering.
Safe to use in noinstr code; preferatomic_sub_return_acquire() elsewhere.
Return
The updated value ofv.
- intraw_atomic_sub_return_release(inti,atomic_t*v)¶
atomic subtract with release ordering
Parameters
intiint value to subtract
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v -i) with release ordering.
Safe to use in noinstr code; preferatomic_sub_return_release() elsewhere.
Return
The updated value ofv.
- intraw_atomic_sub_return_relaxed(inti,atomic_t*v)¶
atomic subtract with relaxed ordering
Parameters
intiint value to subtract
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v -i) with relaxed ordering.
Safe to use in noinstr code; preferatomic_sub_return_relaxed() elsewhere.
Return
The updated value ofv.
- intraw_atomic_fetch_sub(inti,atomic_t*v)¶
atomic subtract with full ordering
Parameters
intiint value to subtract
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v -i) with full ordering.
Safe to use in noinstr code; preferatomic_fetch_sub() elsewhere.
Return
The original value ofv.
- intraw_atomic_fetch_sub_acquire(inti,atomic_t*v)¶
atomic subtract with acquire ordering
Parameters
intiint value to subtract
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v -i) with acquire ordering.
Safe to use in noinstr code; preferatomic_fetch_sub_acquire() elsewhere.
Return
The original value ofv.
- intraw_atomic_fetch_sub_release(inti,atomic_t*v)¶
atomic subtract with release ordering
Parameters
intiint value to subtract
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v -i) with release ordering.
Safe to use in noinstr code; preferatomic_fetch_sub_release() elsewhere.
Return
The original value ofv.
- intraw_atomic_fetch_sub_relaxed(inti,atomic_t*v)¶
atomic subtract with relaxed ordering
Parameters
intiint value to subtract
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v -i) with relaxed ordering.
Safe to use in noinstr code; preferatomic_fetch_sub_relaxed() elsewhere.
Return
The original value ofv.
- voidraw_atomic_inc(atomic_t*v)¶
atomic increment with relaxed ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v + 1) with relaxed ordering.
Safe to use in noinstr code; preferatomic_inc() elsewhere.
Return
Nothing.
- intraw_atomic_inc_return(atomic_t*v)¶
atomic increment with full ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v + 1) with full ordering.
Safe to use in noinstr code; preferatomic_inc_return() elsewhere.
Return
The updated value ofv.
- intraw_atomic_inc_return_acquire(atomic_t*v)¶
atomic increment with acquire ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v + 1) with acquire ordering.
Safe to use in noinstr code; preferatomic_inc_return_acquire() elsewhere.
Return
The updated value ofv.
- intraw_atomic_inc_return_release(atomic_t*v)¶
atomic increment with release ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v + 1) with release ordering.
Safe to use in noinstr code; preferatomic_inc_return_release() elsewhere.
Return
The updated value ofv.
- intraw_atomic_inc_return_relaxed(atomic_t*v)¶
atomic increment with relaxed ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v + 1) with relaxed ordering.
Safe to use in noinstr code; preferatomic_inc_return_relaxed() elsewhere.
Return
The updated value ofv.
- intraw_atomic_fetch_inc(atomic_t*v)¶
atomic increment with full ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v + 1) with full ordering.
Safe to use in noinstr code; preferatomic_fetch_inc() elsewhere.
Return
The original value ofv.
- intraw_atomic_fetch_inc_acquire(atomic_t*v)¶
atomic increment with acquire ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v + 1) with acquire ordering.
Safe to use in noinstr code; preferatomic_fetch_inc_acquire() elsewhere.
Return
The original value ofv.
- intraw_atomic_fetch_inc_release(atomic_t*v)¶
atomic increment with release ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v + 1) with release ordering.
Safe to use in noinstr code; preferatomic_fetch_inc_release() elsewhere.
Return
The original value ofv.
- intraw_atomic_fetch_inc_relaxed(atomic_t*v)¶
atomic increment with relaxed ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v + 1) with relaxed ordering.
Safe to use in noinstr code; preferatomic_fetch_inc_relaxed() elsewhere.
Return
The original value ofv.
- voidraw_atomic_dec(atomic_t*v)¶
atomic decrement with relaxed ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v - 1) with relaxed ordering.
Safe to use in noinstr code; preferatomic_dec() elsewhere.
Return
Nothing.
- intraw_atomic_dec_return(atomic_t*v)¶
atomic decrement with full ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v - 1) with full ordering.
Safe to use in noinstr code; preferatomic_dec_return() elsewhere.
Return
The updated value ofv.
- intraw_atomic_dec_return_acquire(atomic_t*v)¶
atomic decrement with acquire ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v - 1) with acquire ordering.
Safe to use in noinstr code; preferatomic_dec_return_acquire() elsewhere.
Return
The updated value ofv.
- intraw_atomic_dec_return_release(atomic_t*v)¶
atomic decrement with release ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v - 1) with release ordering.
Safe to use in noinstr code; preferatomic_dec_return_release() elsewhere.
Return
The updated value ofv.
- intraw_atomic_dec_return_relaxed(atomic_t*v)¶
atomic decrement with relaxed ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v - 1) with relaxed ordering.
Safe to use in noinstr code; preferatomic_dec_return_relaxed() elsewhere.
Return
The updated value ofv.
- intraw_atomic_fetch_dec(atomic_t*v)¶
atomic decrement with full ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v - 1) with full ordering.
Safe to use in noinstr code; preferatomic_fetch_dec() elsewhere.
Return
The original value ofv.
- intraw_atomic_fetch_dec_acquire(atomic_t*v)¶
atomic decrement with acquire ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v - 1) with acquire ordering.
Safe to use in noinstr code; preferatomic_fetch_dec_acquire() elsewhere.
Return
The original value ofv.
- intraw_atomic_fetch_dec_release(atomic_t*v)¶
atomic decrement with release ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v - 1) with release ordering.
Safe to use in noinstr code; preferatomic_fetch_dec_release() elsewhere.
Return
The original value ofv.
- intraw_atomic_fetch_dec_relaxed(atomic_t*v)¶
atomic decrement with relaxed ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v - 1) with relaxed ordering.
Safe to use in noinstr code; preferatomic_fetch_dec_relaxed() elsewhere.
Return
The original value ofv.
- voidraw_atomic_and(inti,atomic_t*v)¶
atomic bitwise AND with relaxed ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v &i) with relaxed ordering.
Safe to use in noinstr code; preferatomic_and() elsewhere.
Return
Nothing.
- intraw_atomic_fetch_and(inti,atomic_t*v)¶
atomic bitwise AND with full ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v &i) with full ordering.
Safe to use in noinstr code; preferatomic_fetch_and() elsewhere.
Return
The original value ofv.
- intraw_atomic_fetch_and_acquire(inti,atomic_t*v)¶
atomic bitwise AND with acquire ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v &i) with acquire ordering.
Safe to use in noinstr code; preferatomic_fetch_and_acquire() elsewhere.
Return
The original value ofv.
- intraw_atomic_fetch_and_release(inti,atomic_t*v)¶
atomic bitwise AND with release ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v &i) with release ordering.
Safe to use in noinstr code; preferatomic_fetch_and_release() elsewhere.
Return
The original value ofv.
- intraw_atomic_fetch_and_relaxed(inti,atomic_t*v)¶
atomic bitwise AND with relaxed ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v &i) with relaxed ordering.
Safe to use in noinstr code; preferatomic_fetch_and_relaxed() elsewhere.
Return
The original value ofv.
- voidraw_atomic_andnot(inti,atomic_t*v)¶
atomic bitwise AND NOT with relaxed ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v &~i) with relaxed ordering.
Safe to use in noinstr code; preferatomic_andnot() elsewhere.
Return
Nothing.
- intraw_atomic_fetch_andnot(inti,atomic_t*v)¶
atomic bitwise AND NOT with full ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v &~i) with full ordering.
Safe to use in noinstr code; preferatomic_fetch_andnot() elsewhere.
Return
The original value ofv.
- intraw_atomic_fetch_andnot_acquire(inti,atomic_t*v)¶
atomic bitwise AND NOT with acquire ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v &~i) with acquire ordering.
Safe to use in noinstr code; preferatomic_fetch_andnot_acquire() elsewhere.
Return
The original value ofv.
- intraw_atomic_fetch_andnot_release(inti,atomic_t*v)¶
atomic bitwise AND NOT with release ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v &~i) with release ordering.
Safe to use in noinstr code; preferatomic_fetch_andnot_release() elsewhere.
Return
The original value ofv.
- intraw_atomic_fetch_andnot_relaxed(inti,atomic_t*v)¶
atomic bitwise AND NOT with relaxed ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v &~i) with relaxed ordering.
Safe to use in noinstr code; preferatomic_fetch_andnot_relaxed() elsewhere.
Return
The original value ofv.
- voidraw_atomic_or(inti,atomic_t*v)¶
atomic bitwise OR with relaxed ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v |i) with relaxed ordering.
Safe to use in noinstr code; preferatomic_or() elsewhere.
Return
Nothing.
- intraw_atomic_fetch_or(inti,atomic_t*v)¶
atomic bitwise OR with full ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v |i) with full ordering.
Safe to use in noinstr code; preferatomic_fetch_or() elsewhere.
Return
The original value ofv.
- intraw_atomic_fetch_or_acquire(inti,atomic_t*v)¶
atomic bitwise OR with acquire ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v |i) with acquire ordering.
Safe to use in noinstr code; preferatomic_fetch_or_acquire() elsewhere.
Return
The original value ofv.
- intraw_atomic_fetch_or_release(inti,atomic_t*v)¶
atomic bitwise OR with release ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v |i) with release ordering.
Safe to use in noinstr code; preferatomic_fetch_or_release() elsewhere.
Return
The original value ofv.
- intraw_atomic_fetch_or_relaxed(inti,atomic_t*v)¶
atomic bitwise OR with relaxed ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v |i) with relaxed ordering.
Safe to use in noinstr code; preferatomic_fetch_or_relaxed() elsewhere.
Return
The original value ofv.
- voidraw_atomic_xor(inti,atomic_t*v)¶
atomic bitwise XOR with relaxed ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v ^i) with relaxed ordering.
Safe to use in noinstr code; preferatomic_xor() elsewhere.
Return
Nothing.
- intraw_atomic_fetch_xor(inti,atomic_t*v)¶
atomic bitwise XOR with full ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v ^i) with full ordering.
Safe to use in noinstr code; preferatomic_fetch_xor() elsewhere.
Return
The original value ofv.
- intraw_atomic_fetch_xor_acquire(inti,atomic_t*v)¶
atomic bitwise XOR with acquire ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v ^i) with acquire ordering.
Safe to use in noinstr code; preferatomic_fetch_xor_acquire() elsewhere.
Return
The original value ofv.
- intraw_atomic_fetch_xor_release(inti,atomic_t*v)¶
atomic bitwise XOR with release ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v ^i) with release ordering.
Safe to use in noinstr code; preferatomic_fetch_xor_release() elsewhere.
Return
The original value ofv.
- intraw_atomic_fetch_xor_relaxed(inti,atomic_t*v)¶
atomic bitwise XOR with relaxed ordering
Parameters
intiint value
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v ^i) with relaxed ordering.
Safe to use in noinstr code; preferatomic_fetch_xor_relaxed() elsewhere.
Return
The original value ofv.
- intraw_atomic_xchg(atomic_t*v,intnew)¶
atomic exchange with full ordering
Parameters
atomic_t*vpointer to atomic_t
intnewint value to assign
Description
Atomically updatesv tonew with full ordering.
Safe to use in noinstr code; preferatomic_xchg() elsewhere.
Return
The original value ofv.
- intraw_atomic_xchg_acquire(atomic_t*v,intnew)¶
atomic exchange with acquire ordering
Parameters
atomic_t*vpointer to atomic_t
intnewint value to assign
Description
Atomically updatesv tonew with acquire ordering.
Safe to use in noinstr code; preferatomic_xchg_acquire() elsewhere.
Return
The original value ofv.
- intraw_atomic_xchg_release(atomic_t*v,intnew)¶
atomic exchange with release ordering
Parameters
atomic_t*vpointer to atomic_t
intnewint value to assign
Description
Atomically updatesv tonew with release ordering.
Safe to use in noinstr code; preferatomic_xchg_release() elsewhere.
Return
The original value ofv.
- intraw_atomic_xchg_relaxed(atomic_t*v,intnew)¶
atomic exchange with relaxed ordering
Parameters
atomic_t*vpointer to atomic_t
intnewint value to assign
Description
Atomically updatesv tonew with relaxed ordering.
Safe to use in noinstr code; preferatomic_xchg_relaxed() elsewhere.
Return
The original value ofv.
- intraw_atomic_cmpxchg(atomic_t*v,intold,intnew)¶
atomic compare and exchange with full ordering
Parameters
atomic_t*vpointer to atomic_t
intoldint value to compare with
intnewint value to assign
Description
If (v ==old), atomically updatesv tonew with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic_cmpxchg() elsewhere.
Return
The original value ofv.
- intraw_atomic_cmpxchg_acquire(atomic_t*v,intold,intnew)¶
atomic compare and exchange with acquire ordering
Parameters
atomic_t*vpointer to atomic_t
intoldint value to compare with
intnewint value to assign
Description
If (v ==old), atomically updatesv tonew with acquire ordering.Otherwise,v is not modified and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic_cmpxchg_acquire() elsewhere.
Return
The original value ofv.
- intraw_atomic_cmpxchg_release(atomic_t*v,intold,intnew)¶
atomic compare and exchange with release ordering
Parameters
atomic_t*vpointer to atomic_t
intoldint value to compare with
intnewint value to assign
Description
If (v ==old), atomically updatesv tonew with release ordering.Otherwise,v is not modified and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic_cmpxchg_release() elsewhere.
Return
The original value ofv.
- intraw_atomic_cmpxchg_relaxed(atomic_t*v,intold,intnew)¶
atomic compare and exchange with relaxed ordering
Parameters
atomic_t*vpointer to atomic_t
intoldint value to compare with
intnewint value to assign
Description
If (v ==old), atomically updatesv tonew with relaxed ordering.Otherwise,v is not modified and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic_cmpxchg_relaxed() elsewhere.
Return
The original value ofv.
- boolraw_atomic_try_cmpxchg(atomic_t*v,int*old,intnew)¶
atomic compare and exchange with full ordering
Parameters
atomic_t*vpointer to atomic_t
int*oldpointer to int value to compare with
intnewint value to assign
Description
If (v ==old), atomically updatesv tonew with full ordering.Otherwise,v is not modified,old is updated to the current value ofv,and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic_try_cmpxchg() elsewhere.
Return
true if the exchange occured,false otherwise.
- boolraw_atomic_try_cmpxchg_acquire(atomic_t*v,int*old,intnew)¶
atomic compare and exchange with acquire ordering
Parameters
atomic_t*vpointer to atomic_t
int*oldpointer to int value to compare with
intnewint value to assign
Description
If (v ==old), atomically updatesv tonew with acquire ordering.Otherwise,v is not modified,old is updated to the current value ofv,and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic_try_cmpxchg_acquire() elsewhere.
Return
true if the exchange occured,false otherwise.
- boolraw_atomic_try_cmpxchg_release(atomic_t*v,int*old,intnew)¶
atomic compare and exchange with release ordering
Parameters
atomic_t*vpointer to atomic_t
int*oldpointer to int value to compare with
intnewint value to assign
Description
If (v ==old), atomically updatesv tonew with release ordering.Otherwise,v is not modified,old is updated to the current value ofv,and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic_try_cmpxchg_release() elsewhere.
Return
true if the exchange occured,false otherwise.
- boolraw_atomic_try_cmpxchg_relaxed(atomic_t*v,int*old,intnew)¶
atomic compare and exchange with relaxed ordering
Parameters
atomic_t*vpointer to atomic_t
int*oldpointer to int value to compare with
intnewint value to assign
Description
If (v ==old), atomically updatesv tonew with relaxed ordering.Otherwise,v is not modified,old is updated to the current value ofv,and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic_try_cmpxchg_relaxed() elsewhere.
Return
true if the exchange occured,false otherwise.
- boolraw_atomic_sub_and_test(inti,atomic_t*v)¶
atomic subtract and test if zero with full ordering
Parameters
intiint value to subtract
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v -i) with full ordering.
Safe to use in noinstr code; preferatomic_sub_and_test() elsewhere.
Return
true if the resulting value ofv is zero,false otherwise.
- boolraw_atomic_dec_and_test(atomic_t*v)¶
atomic decrement and test if zero with full ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v - 1) with full ordering.
Safe to use in noinstr code; preferatomic_dec_and_test() elsewhere.
Return
true if the resulting value ofv is zero,false otherwise.
- boolraw_atomic_inc_and_test(atomic_t*v)¶
atomic increment and test if zero with full ordering
Parameters
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v + 1) with full ordering.
Safe to use in noinstr code; preferatomic_inc_and_test() elsewhere.
Return
true if the resulting value ofv is zero,false otherwise.
- boolraw_atomic_add_negative(inti,atomic_t*v)¶
atomic add and test if negative with full ordering
Parameters
intiint value to add
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v +i) with full ordering.
Safe to use in noinstr code; preferatomic_add_negative() elsewhere.
Return
true if the resulting value ofv is negative,false otherwise.
- boolraw_atomic_add_negative_acquire(inti,atomic_t*v)¶
atomic add and test if negative with acquire ordering
Parameters
intiint value to add
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v +i) with acquire ordering.
Safe to use in noinstr code; preferatomic_add_negative_acquire() elsewhere.
Return
true if the resulting value ofv is negative,false otherwise.
- boolraw_atomic_add_negative_release(inti,atomic_t*v)¶
atomic add and test if negative with release ordering
Parameters
intiint value to add
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v +i) with release ordering.
Safe to use in noinstr code; preferatomic_add_negative_release() elsewhere.
Return
true if the resulting value ofv is negative,false otherwise.
- boolraw_atomic_add_negative_relaxed(inti,atomic_t*v)¶
atomic add and test if negative with relaxed ordering
Parameters
intiint value to add
atomic_t*vpointer to atomic_t
Description
Atomically updatesv to (v +i) with relaxed ordering.
Safe to use in noinstr code; preferatomic_add_negative_relaxed() elsewhere.
Return
true if the resulting value ofv is negative,false otherwise.
- intraw_atomic_fetch_add_unless(atomic_t*v,inta,intu)¶
atomic add unless value with full ordering
Parameters
atomic_t*vpointer to atomic_t
intaint value to add
intuint value to compare with
Description
If (v !=u), atomically updatesv to (v +a) with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic_fetch_add_unless() elsewhere.
Return
The original value ofv.
- boolraw_atomic_add_unless(atomic_t*v,inta,intu)¶
atomic add unless value with full ordering
Parameters
atomic_t*vpointer to atomic_t
intaint value to add
intuint value to compare with
Description
If (v !=u), atomically updatesv to (v +a) with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic_add_unless() elsewhere.
Return
true ifv was updated,false otherwise.
- boolraw_atomic_inc_not_zero(atomic_t*v)¶
atomic increment unless zero with full ordering
Parameters
atomic_t*vpointer to atomic_t
Description
If (v != 0), atomically updatesv to (v + 1) with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic_inc_not_zero() elsewhere.
Return
true ifv was updated,false otherwise.
- boolraw_atomic_inc_unless_negative(atomic_t*v)¶
atomic increment unless negative with full ordering
Parameters
atomic_t*vpointer to atomic_t
Description
If (v >= 0), atomically updatesv to (v + 1) with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic_inc_unless_negative() elsewhere.
Return
true ifv was updated,false otherwise.
- boolraw_atomic_dec_unless_positive(atomic_t*v)¶
atomic decrement unless positive with full ordering
Parameters
atomic_t*vpointer to atomic_t
Description
If (v <= 0), atomically updatesv to (v - 1) with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic_dec_unless_positive() elsewhere.
Return
true ifv was updated,false otherwise.
- intraw_atomic_dec_if_positive(atomic_t*v)¶
atomic decrement if positive with full ordering
Parameters
atomic_t*vpointer to atomic_t
Description
If (v > 0), atomically updatesv to (v - 1) with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic_dec_if_positive() elsewhere.
Return
The old value of (v - 1), regardless of whetherv was updated.
- s64raw_atomic64_read(constatomic64_t*v)¶
atomic load with relaxed ordering
Parameters
constatomic64_t*vpointer to atomic64_t
Description
Atomically loads the value ofv with relaxed ordering.
Safe to use in noinstr code; preferatomic64_read() elsewhere.
Return
The value loaded fromv.
- s64raw_atomic64_read_acquire(constatomic64_t*v)¶
atomic load with acquire ordering
Parameters
constatomic64_t*vpointer to atomic64_t
Description
Atomically loads the value ofv with acquire ordering.
Safe to use in noinstr code; preferatomic64_read_acquire() elsewhere.
Return
The value loaded fromv.
- voidraw_atomic64_set(atomic64_t*v,s64i)¶
atomic set with relaxed ordering
Parameters
atomic64_t*vpointer to atomic64_t
s64is64 value to assign
Description
Atomically setsv toi with relaxed ordering.
Safe to use in noinstr code; preferatomic64_set() elsewhere.
Return
Nothing.
- voidraw_atomic64_set_release(atomic64_t*v,s64i)¶
atomic set with release ordering
Parameters
atomic64_t*vpointer to atomic64_t
s64is64 value to assign
Description
Atomically setsv toi with release ordering.
Safe to use in noinstr code; preferatomic64_set_release() elsewhere.
Return
Nothing.
- voidraw_atomic64_add(s64i,atomic64_t*v)¶
atomic add with relaxed ordering
Parameters
s64is64 value to add
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v +i) with relaxed ordering.
Safe to use in noinstr code; preferatomic64_add() elsewhere.
Return
Nothing.
- s64raw_atomic64_add_return(s64i,atomic64_t*v)¶
atomic add with full ordering
Parameters
s64is64 value to add
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v +i) with full ordering.
Safe to use in noinstr code; preferatomic64_add_return() elsewhere.
Return
The updated value ofv.
- s64raw_atomic64_add_return_acquire(s64i,atomic64_t*v)¶
atomic add with acquire ordering
Parameters
s64is64 value to add
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v +i) with acquire ordering.
Safe to use in noinstr code; preferatomic64_add_return_acquire() elsewhere.
Return
The updated value ofv.
- s64raw_atomic64_add_return_release(s64i,atomic64_t*v)¶
atomic add with release ordering
Parameters
s64is64 value to add
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v +i) with release ordering.
Safe to use in noinstr code; preferatomic64_add_return_release() elsewhere.
Return
The updated value ofv.
- s64raw_atomic64_add_return_relaxed(s64i,atomic64_t*v)¶
atomic add with relaxed ordering
Parameters
s64is64 value to add
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v +i) with relaxed ordering.
Safe to use in noinstr code; preferatomic64_add_return_relaxed() elsewhere.
Return
The updated value ofv.
- s64raw_atomic64_fetch_add(s64i,atomic64_t*v)¶
atomic add with full ordering
Parameters
s64is64 value to add
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v +i) with full ordering.
Safe to use in noinstr code; preferatomic64_fetch_add() elsewhere.
Return
The original value ofv.
- s64raw_atomic64_fetch_add_acquire(s64i,atomic64_t*v)¶
atomic add with acquire ordering
Parameters
s64is64 value to add
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v +i) with acquire ordering.
Safe to use in noinstr code; preferatomic64_fetch_add_acquire() elsewhere.
Return
The original value ofv.
- s64raw_atomic64_fetch_add_release(s64i,atomic64_t*v)¶
atomic add with release ordering
Parameters
s64is64 value to add
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v +i) with release ordering.
Safe to use in noinstr code; preferatomic64_fetch_add_release() elsewhere.
Return
The original value ofv.
- s64raw_atomic64_fetch_add_relaxed(s64i,atomic64_t*v)¶
atomic add with relaxed ordering
Parameters
s64is64 value to add
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v +i) with relaxed ordering.
Safe to use in noinstr code; preferatomic64_fetch_add_relaxed() elsewhere.
Return
The original value ofv.
- voidraw_atomic64_sub(s64i,atomic64_t*v)¶
atomic subtract with relaxed ordering
Parameters
s64is64 value to subtract
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v -i) with relaxed ordering.
Safe to use in noinstr code; preferatomic64_sub() elsewhere.
Return
Nothing.
- s64raw_atomic64_sub_return(s64i,atomic64_t*v)¶
atomic subtract with full ordering
Parameters
s64is64 value to subtract
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v -i) with full ordering.
Safe to use in noinstr code; preferatomic64_sub_return() elsewhere.
Return
The updated value ofv.
- s64raw_atomic64_sub_return_acquire(s64i,atomic64_t*v)¶
atomic subtract with acquire ordering
Parameters
s64is64 value to subtract
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v -i) with acquire ordering.
Safe to use in noinstr code; preferatomic64_sub_return_acquire() elsewhere.
Return
The updated value ofv.
- s64raw_atomic64_sub_return_release(s64i,atomic64_t*v)¶
atomic subtract with release ordering
Parameters
s64is64 value to subtract
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v -i) with release ordering.
Safe to use in noinstr code; preferatomic64_sub_return_release() elsewhere.
Return
The updated value ofv.
- s64raw_atomic64_sub_return_relaxed(s64i,atomic64_t*v)¶
atomic subtract with relaxed ordering
Parameters
s64is64 value to subtract
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v -i) with relaxed ordering.
Safe to use in noinstr code; preferatomic64_sub_return_relaxed() elsewhere.
Return
The updated value ofv.
- s64raw_atomic64_fetch_sub(s64i,atomic64_t*v)¶
atomic subtract with full ordering
Parameters
s64is64 value to subtract
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v -i) with full ordering.
Safe to use in noinstr code; preferatomic64_fetch_sub() elsewhere.
Return
The original value ofv.
- s64raw_atomic64_fetch_sub_acquire(s64i,atomic64_t*v)¶
atomic subtract with acquire ordering
Parameters
s64is64 value to subtract
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v -i) with acquire ordering.
Safe to use in noinstr code; preferatomic64_fetch_sub_acquire() elsewhere.
Return
The original value ofv.
- s64raw_atomic64_fetch_sub_release(s64i,atomic64_t*v)¶
atomic subtract with release ordering
Parameters
s64is64 value to subtract
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v -i) with release ordering.
Safe to use in noinstr code; preferatomic64_fetch_sub_release() elsewhere.
Return
The original value ofv.
- s64raw_atomic64_fetch_sub_relaxed(s64i,atomic64_t*v)¶
atomic subtract with relaxed ordering
Parameters
s64is64 value to subtract
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v -i) with relaxed ordering.
Safe to use in noinstr code; preferatomic64_fetch_sub_relaxed() elsewhere.
Return
The original value ofv.
- voidraw_atomic64_inc(atomic64_t*v)¶
atomic increment with relaxed ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v + 1) with relaxed ordering.
Safe to use in noinstr code; preferatomic64_inc() elsewhere.
Return
Nothing.
- s64raw_atomic64_inc_return(atomic64_t*v)¶
atomic increment with full ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v + 1) with full ordering.
Safe to use in noinstr code; preferatomic64_inc_return() elsewhere.
Return
The updated value ofv.
- s64raw_atomic64_inc_return_acquire(atomic64_t*v)¶
atomic increment with acquire ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v + 1) with acquire ordering.
Safe to use in noinstr code; preferatomic64_inc_return_acquire() elsewhere.
Return
The updated value ofv.
- s64raw_atomic64_inc_return_release(atomic64_t*v)¶
atomic increment with release ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v + 1) with release ordering.
Safe to use in noinstr code; preferatomic64_inc_return_release() elsewhere.
Return
The updated value ofv.
- s64raw_atomic64_inc_return_relaxed(atomic64_t*v)¶
atomic increment with relaxed ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v + 1) with relaxed ordering.
Safe to use in noinstr code; preferatomic64_inc_return_relaxed() elsewhere.
Return
The updated value ofv.
- s64raw_atomic64_fetch_inc(atomic64_t*v)¶
atomic increment with full ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v + 1) with full ordering.
Safe to use in noinstr code; preferatomic64_fetch_inc() elsewhere.
Return
The original value ofv.
- s64raw_atomic64_fetch_inc_acquire(atomic64_t*v)¶
atomic increment with acquire ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v + 1) with acquire ordering.
Safe to use in noinstr code; preferatomic64_fetch_inc_acquire() elsewhere.
Return
The original value ofv.
- s64raw_atomic64_fetch_inc_release(atomic64_t*v)¶
atomic increment with release ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v + 1) with release ordering.
Safe to use in noinstr code; preferatomic64_fetch_inc_release() elsewhere.
Return
The original value ofv.
- s64raw_atomic64_fetch_inc_relaxed(atomic64_t*v)¶
atomic increment with relaxed ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v + 1) with relaxed ordering.
Safe to use in noinstr code; preferatomic64_fetch_inc_relaxed() elsewhere.
Return
The original value ofv.
- voidraw_atomic64_dec(atomic64_t*v)¶
atomic decrement with relaxed ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v - 1) with relaxed ordering.
Safe to use in noinstr code; preferatomic64_dec() elsewhere.
Return
Nothing.
- s64raw_atomic64_dec_return(atomic64_t*v)¶
atomic decrement with full ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v - 1) with full ordering.
Safe to use in noinstr code; preferatomic64_dec_return() elsewhere.
Return
The updated value ofv.
- s64raw_atomic64_dec_return_acquire(atomic64_t*v)¶
atomic decrement with acquire ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v - 1) with acquire ordering.
Safe to use in noinstr code; preferatomic64_dec_return_acquire() elsewhere.
Return
The updated value ofv.
- s64raw_atomic64_dec_return_release(atomic64_t*v)¶
atomic decrement with release ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v - 1) with release ordering.
Safe to use in noinstr code; preferatomic64_dec_return_release() elsewhere.
Return
The updated value ofv.
- s64raw_atomic64_dec_return_relaxed(atomic64_t*v)¶
atomic decrement with relaxed ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v - 1) with relaxed ordering.
Safe to use in noinstr code; preferatomic64_dec_return_relaxed() elsewhere.
Return
The updated value ofv.
- s64raw_atomic64_fetch_dec(atomic64_t*v)¶
atomic decrement with full ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v - 1) with full ordering.
Safe to use in noinstr code; preferatomic64_fetch_dec() elsewhere.
Return
The original value ofv.
- s64raw_atomic64_fetch_dec_acquire(atomic64_t*v)¶
atomic decrement with acquire ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v - 1) with acquire ordering.
Safe to use in noinstr code; preferatomic64_fetch_dec_acquire() elsewhere.
Return
The original value ofv.
- s64raw_atomic64_fetch_dec_release(atomic64_t*v)¶
atomic decrement with release ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v - 1) with release ordering.
Safe to use in noinstr code; preferatomic64_fetch_dec_release() elsewhere.
Return
The original value ofv.
- s64raw_atomic64_fetch_dec_relaxed(atomic64_t*v)¶
atomic decrement with relaxed ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v - 1) with relaxed ordering.
Safe to use in noinstr code; preferatomic64_fetch_dec_relaxed() elsewhere.
Return
The original value ofv.
- voidraw_atomic64_and(s64i,atomic64_t*v)¶
atomic bitwise AND with relaxed ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v &i) with relaxed ordering.
Safe to use in noinstr code; preferatomic64_and() elsewhere.
Return
Nothing.
- s64raw_atomic64_fetch_and(s64i,atomic64_t*v)¶
atomic bitwise AND with full ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v &i) with full ordering.
Safe to use in noinstr code; preferatomic64_fetch_and() elsewhere.
Return
The original value ofv.
- s64raw_atomic64_fetch_and_acquire(s64i,atomic64_t*v)¶
atomic bitwise AND with acquire ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v &i) with acquire ordering.
Safe to use in noinstr code; preferatomic64_fetch_and_acquire() elsewhere.
Return
The original value ofv.
- s64raw_atomic64_fetch_and_release(s64i,atomic64_t*v)¶
atomic bitwise AND with release ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v &i) with release ordering.
Safe to use in noinstr code; preferatomic64_fetch_and_release() elsewhere.
Return
The original value ofv.
- s64raw_atomic64_fetch_and_relaxed(s64i,atomic64_t*v)¶
atomic bitwise AND with relaxed ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v &i) with relaxed ordering.
Safe to use in noinstr code; preferatomic64_fetch_and_relaxed() elsewhere.
Return
The original value ofv.
- voidraw_atomic64_andnot(s64i,atomic64_t*v)¶
atomic bitwise AND NOT with relaxed ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v &~i) with relaxed ordering.
Safe to use in noinstr code; preferatomic64_andnot() elsewhere.
Return
Nothing.
- s64raw_atomic64_fetch_andnot(s64i,atomic64_t*v)¶
atomic bitwise AND NOT with full ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v &~i) with full ordering.
Safe to use in noinstr code; preferatomic64_fetch_andnot() elsewhere.
Return
The original value ofv.
- s64raw_atomic64_fetch_andnot_acquire(s64i,atomic64_t*v)¶
atomic bitwise AND NOT with acquire ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v &~i) with acquire ordering.
Safe to use in noinstr code; preferatomic64_fetch_andnot_acquire() elsewhere.
Return
The original value ofv.
- s64raw_atomic64_fetch_andnot_release(s64i,atomic64_t*v)¶
atomic bitwise AND NOT with release ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v &~i) with release ordering.
Safe to use in noinstr code; preferatomic64_fetch_andnot_release() elsewhere.
Return
The original value ofv.
- s64raw_atomic64_fetch_andnot_relaxed(s64i,atomic64_t*v)¶
atomic bitwise AND NOT with relaxed ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v &~i) with relaxed ordering.
Safe to use in noinstr code; preferatomic64_fetch_andnot_relaxed() elsewhere.
Return
The original value ofv.
- voidraw_atomic64_or(s64i,atomic64_t*v)¶
atomic bitwise OR with relaxed ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v |i) with relaxed ordering.
Safe to use in noinstr code; preferatomic64_or() elsewhere.
Return
Nothing.
- s64raw_atomic64_fetch_or(s64i,atomic64_t*v)¶
atomic bitwise OR with full ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v |i) with full ordering.
Safe to use in noinstr code; preferatomic64_fetch_or() elsewhere.
Return
The original value ofv.
- s64raw_atomic64_fetch_or_acquire(s64i,atomic64_t*v)¶
atomic bitwise OR with acquire ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v |i) with acquire ordering.
Safe to use in noinstr code; preferatomic64_fetch_or_acquire() elsewhere.
Return
The original value ofv.
- s64raw_atomic64_fetch_or_release(s64i,atomic64_t*v)¶
atomic bitwise OR with release ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v |i) with release ordering.
Safe to use in noinstr code; preferatomic64_fetch_or_release() elsewhere.
Return
The original value ofv.
- s64raw_atomic64_fetch_or_relaxed(s64i,atomic64_t*v)¶
atomic bitwise OR with relaxed ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v |i) with relaxed ordering.
Safe to use in noinstr code; preferatomic64_fetch_or_relaxed() elsewhere.
Return
The original value ofv.
- voidraw_atomic64_xor(s64i,atomic64_t*v)¶
atomic bitwise XOR with relaxed ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v ^i) with relaxed ordering.
Safe to use in noinstr code; preferatomic64_xor() elsewhere.
Return
Nothing.
- s64raw_atomic64_fetch_xor(s64i,atomic64_t*v)¶
atomic bitwise XOR with full ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v ^i) with full ordering.
Safe to use in noinstr code; preferatomic64_fetch_xor() elsewhere.
Return
The original value ofv.
- s64raw_atomic64_fetch_xor_acquire(s64i,atomic64_t*v)¶
atomic bitwise XOR with acquire ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v ^i) with acquire ordering.
Safe to use in noinstr code; preferatomic64_fetch_xor_acquire() elsewhere.
Return
The original value ofv.
- s64raw_atomic64_fetch_xor_release(s64i,atomic64_t*v)¶
atomic bitwise XOR with release ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v ^i) with release ordering.
Safe to use in noinstr code; preferatomic64_fetch_xor_release() elsewhere.
Return
The original value ofv.
- s64raw_atomic64_fetch_xor_relaxed(s64i,atomic64_t*v)¶
atomic bitwise XOR with relaxed ordering
Parameters
s64is64 value
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v ^i) with relaxed ordering.
Safe to use in noinstr code; preferatomic64_fetch_xor_relaxed() elsewhere.
Return
The original value ofv.
- s64raw_atomic64_xchg(atomic64_t*v,s64new)¶
atomic exchange with full ordering
Parameters
atomic64_t*vpointer to atomic64_t
s64news64 value to assign
Description
Atomically updatesv tonew with full ordering.
Safe to use in noinstr code; preferatomic64_xchg() elsewhere.
Return
The original value ofv.
- s64raw_atomic64_xchg_acquire(atomic64_t*v,s64new)¶
atomic exchange with acquire ordering
Parameters
atomic64_t*vpointer to atomic64_t
s64news64 value to assign
Description
Atomically updatesv tonew with acquire ordering.
Safe to use in noinstr code; preferatomic64_xchg_acquire() elsewhere.
Return
The original value ofv.
- s64raw_atomic64_xchg_release(atomic64_t*v,s64new)¶
atomic exchange with release ordering
Parameters
atomic64_t*vpointer to atomic64_t
s64news64 value to assign
Description
Atomically updatesv tonew with release ordering.
Safe to use in noinstr code; preferatomic64_xchg_release() elsewhere.
Return
The original value ofv.
- s64raw_atomic64_xchg_relaxed(atomic64_t*v,s64new)¶
atomic exchange with relaxed ordering
Parameters
atomic64_t*vpointer to atomic64_t
s64news64 value to assign
Description
Atomically updatesv tonew with relaxed ordering.
Safe to use in noinstr code; preferatomic64_xchg_relaxed() elsewhere.
Return
The original value ofv.
- s64raw_atomic64_cmpxchg(atomic64_t*v,s64old,s64new)¶
atomic compare and exchange with full ordering
Parameters
atomic64_t*vpointer to atomic64_t
s64olds64 value to compare with
s64news64 value to assign
Description
If (v ==old), atomically updatesv tonew with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic64_cmpxchg() elsewhere.
Return
The original value ofv.
- s64raw_atomic64_cmpxchg_acquire(atomic64_t*v,s64old,s64new)¶
atomic compare and exchange with acquire ordering
Parameters
atomic64_t*vpointer to atomic64_t
s64olds64 value to compare with
s64news64 value to assign
Description
If (v ==old), atomically updatesv tonew with acquire ordering.Otherwise,v is not modified and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic64_cmpxchg_acquire() elsewhere.
Return
The original value ofv.
- s64raw_atomic64_cmpxchg_release(atomic64_t*v,s64old,s64new)¶
atomic compare and exchange with release ordering
Parameters
atomic64_t*vpointer to atomic64_t
s64olds64 value to compare with
s64news64 value to assign
Description
If (v ==old), atomically updatesv tonew with release ordering.Otherwise,v is not modified and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic64_cmpxchg_release() elsewhere.
Return
The original value ofv.
- s64raw_atomic64_cmpxchg_relaxed(atomic64_t*v,s64old,s64new)¶
atomic compare and exchange with relaxed ordering
Parameters
atomic64_t*vpointer to atomic64_t
s64olds64 value to compare with
s64news64 value to assign
Description
If (v ==old), atomically updatesv tonew with relaxed ordering.Otherwise,v is not modified and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic64_cmpxchg_relaxed() elsewhere.
Return
The original value ofv.
- boolraw_atomic64_try_cmpxchg(atomic64_t*v,s64*old,s64new)¶
atomic compare and exchange with full ordering
Parameters
atomic64_t*vpointer to atomic64_t
s64*oldpointer to s64 value to compare with
s64news64 value to assign
Description
If (v ==old), atomically updatesv tonew with full ordering.Otherwise,v is not modified,old is updated to the current value ofv,and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic64_try_cmpxchg() elsewhere.
Return
true if the exchange occured,false otherwise.
- boolraw_atomic64_try_cmpxchg_acquire(atomic64_t*v,s64*old,s64new)¶
atomic compare and exchange with acquire ordering
Parameters
atomic64_t*vpointer to atomic64_t
s64*oldpointer to s64 value to compare with
s64news64 value to assign
Description
If (v ==old), atomically updatesv tonew with acquire ordering.Otherwise,v is not modified,old is updated to the current value ofv,and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic64_try_cmpxchg_acquire() elsewhere.
Return
true if the exchange occured,false otherwise.
- boolraw_atomic64_try_cmpxchg_release(atomic64_t*v,s64*old,s64new)¶
atomic compare and exchange with release ordering
Parameters
atomic64_t*vpointer to atomic64_t
s64*oldpointer to s64 value to compare with
s64news64 value to assign
Description
If (v ==old), atomically updatesv tonew with release ordering.Otherwise,v is not modified,old is updated to the current value ofv,and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic64_try_cmpxchg_release() elsewhere.
Return
true if the exchange occured,false otherwise.
- boolraw_atomic64_try_cmpxchg_relaxed(atomic64_t*v,s64*old,s64new)¶
atomic compare and exchange with relaxed ordering
Parameters
atomic64_t*vpointer to atomic64_t
s64*oldpointer to s64 value to compare with
s64news64 value to assign
Description
If (v ==old), atomically updatesv tonew with relaxed ordering.Otherwise,v is not modified,old is updated to the current value ofv,and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic64_try_cmpxchg_relaxed() elsewhere.
Return
true if the exchange occured,false otherwise.
- boolraw_atomic64_sub_and_test(s64i,atomic64_t*v)¶
atomic subtract and test if zero with full ordering
Parameters
s64is64 value to subtract
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v -i) with full ordering.
Safe to use in noinstr code; preferatomic64_sub_and_test() elsewhere.
Return
true if the resulting value ofv is zero,false otherwise.
- boolraw_atomic64_dec_and_test(atomic64_t*v)¶
atomic decrement and test if zero with full ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v - 1) with full ordering.
Safe to use in noinstr code; preferatomic64_dec_and_test() elsewhere.
Return
true if the resulting value ofv is zero,false otherwise.
- boolraw_atomic64_inc_and_test(atomic64_t*v)¶
atomic increment and test if zero with full ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v + 1) with full ordering.
Safe to use in noinstr code; preferatomic64_inc_and_test() elsewhere.
Return
true if the resulting value ofv is zero,false otherwise.
- boolraw_atomic64_add_negative(s64i,atomic64_t*v)¶
atomic add and test if negative with full ordering
Parameters
s64is64 value to add
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v +i) with full ordering.
Safe to use in noinstr code; preferatomic64_add_negative() elsewhere.
Return
true if the resulting value ofv is negative,false otherwise.
- boolraw_atomic64_add_negative_acquire(s64i,atomic64_t*v)¶
atomic add and test if negative with acquire ordering
Parameters
s64is64 value to add
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v +i) with acquire ordering.
Safe to use in noinstr code; preferatomic64_add_negative_acquire() elsewhere.
Return
true if the resulting value ofv is negative,false otherwise.
- boolraw_atomic64_add_negative_release(s64i,atomic64_t*v)¶
atomic add and test if negative with release ordering
Parameters
s64is64 value to add
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v +i) with release ordering.
Safe to use in noinstr code; preferatomic64_add_negative_release() elsewhere.
Return
true if the resulting value ofv is negative,false otherwise.
- boolraw_atomic64_add_negative_relaxed(s64i,atomic64_t*v)¶
atomic add and test if negative with relaxed ordering
Parameters
s64is64 value to add
atomic64_t*vpointer to atomic64_t
Description
Atomically updatesv to (v +i) with relaxed ordering.
Safe to use in noinstr code; preferatomic64_add_negative_relaxed() elsewhere.
Return
true if the resulting value ofv is negative,false otherwise.
- s64raw_atomic64_fetch_add_unless(atomic64_t*v,s64a,s64u)¶
atomic add unless value with full ordering
Parameters
atomic64_t*vpointer to atomic64_t
s64as64 value to add
s64us64 value to compare with
Description
If (v !=u), atomically updatesv to (v +a) with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic64_fetch_add_unless() elsewhere.
Return
The original value ofv.
- boolraw_atomic64_add_unless(atomic64_t*v,s64a,s64u)¶
atomic add unless value with full ordering
Parameters
atomic64_t*vpointer to atomic64_t
s64as64 value to add
s64us64 value to compare with
Description
If (v !=u), atomically updatesv to (v +a) with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic64_add_unless() elsewhere.
Return
true ifv was updated,false otherwise.
- boolraw_atomic64_inc_not_zero(atomic64_t*v)¶
atomic increment unless zero with full ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
If (v != 0), atomically updatesv to (v + 1) with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic64_inc_not_zero() elsewhere.
Return
true ifv was updated,false otherwise.
- boolraw_atomic64_inc_unless_negative(atomic64_t*v)¶
atomic increment unless negative with full ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
If (v >= 0), atomically updatesv to (v + 1) with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic64_inc_unless_negative() elsewhere.
Return
true ifv was updated,false otherwise.
- boolraw_atomic64_dec_unless_positive(atomic64_t*v)¶
atomic decrement unless positive with full ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
If (v <= 0), atomically updatesv to (v - 1) with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic64_dec_unless_positive() elsewhere.
Return
true ifv was updated,false otherwise.
- s64raw_atomic64_dec_if_positive(atomic64_t*v)¶
atomic decrement if positive with full ordering
Parameters
atomic64_t*vpointer to atomic64_t
Description
If (v > 0), atomically updatesv to (v - 1) with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic64_dec_if_positive() elsewhere.
Return
The old value of (v - 1), regardless of whetherv was updated.
- longraw_atomic_long_read(constatomic_long_t*v)¶
atomic load with relaxed ordering
Parameters
constatomic_long_t*vpointer to atomic_long_t
Description
Atomically loads the value ofv with relaxed ordering.
Safe to use in noinstr code; preferatomic_long_read() elsewhere.
Return
The value loaded fromv.
- longraw_atomic_long_read_acquire(constatomic_long_t*v)¶
atomic load with acquire ordering
Parameters
constatomic_long_t*vpointer to atomic_long_t
Description
Atomically loads the value ofv with acquire ordering.
Safe to use in noinstr code; preferatomic_long_read_acquire() elsewhere.
Return
The value loaded fromv.
- voidraw_atomic_long_set(atomic_long_t*v,longi)¶
atomic set with relaxed ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
longilong value to assign
Description
Atomically setsv toi with relaxed ordering.
Safe to use in noinstr code; preferatomic_long_set() elsewhere.
Return
Nothing.
- voidraw_atomic_long_set_release(atomic_long_t*v,longi)¶
atomic set with release ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
longilong value to assign
Description
Atomically setsv toi with release ordering.
Safe to use in noinstr code; preferatomic_long_set_release() elsewhere.
Return
Nothing.
- voidraw_atomic_long_add(longi,atomic_long_t*v)¶
atomic add with relaxed ordering
Parameters
longilong value to add
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v +i) with relaxed ordering.
Safe to use in noinstr code; preferatomic_long_add() elsewhere.
Return
Nothing.
- longraw_atomic_long_add_return(longi,atomic_long_t*v)¶
atomic add with full ordering
Parameters
longilong value to add
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v +i) with full ordering.
Safe to use in noinstr code; preferatomic_long_add_return() elsewhere.
Return
The updated value ofv.
- longraw_atomic_long_add_return_acquire(longi,atomic_long_t*v)¶
atomic add with acquire ordering
Parameters
longilong value to add
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v +i) with acquire ordering.
Safe to use in noinstr code; preferatomic_long_add_return_acquire() elsewhere.
Return
The updated value ofv.
- longraw_atomic_long_add_return_release(longi,atomic_long_t*v)¶
atomic add with release ordering
Parameters
longilong value to add
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v +i) with release ordering.
Safe to use in noinstr code; preferatomic_long_add_return_release() elsewhere.
Return
The updated value ofv.
- longraw_atomic_long_add_return_relaxed(longi,atomic_long_t*v)¶
atomic add with relaxed ordering
Parameters
longilong value to add
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v +i) with relaxed ordering.
Safe to use in noinstr code; preferatomic_long_add_return_relaxed() elsewhere.
Return
The updated value ofv.
- longraw_atomic_long_fetch_add(longi,atomic_long_t*v)¶
atomic add with full ordering
Parameters
longilong value to add
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v +i) with full ordering.
Safe to use in noinstr code; preferatomic_long_fetch_add() elsewhere.
Return
The original value ofv.
- longraw_atomic_long_fetch_add_acquire(longi,atomic_long_t*v)¶
atomic add with acquire ordering
Parameters
longilong value to add
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v +i) with acquire ordering.
Safe to use in noinstr code; preferatomic_long_fetch_add_acquire() elsewhere.
Return
The original value ofv.
- longraw_atomic_long_fetch_add_release(longi,atomic_long_t*v)¶
atomic add with release ordering
Parameters
longilong value to add
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v +i) with release ordering.
Safe to use in noinstr code; preferatomic_long_fetch_add_release() elsewhere.
Return
The original value ofv.
- longraw_atomic_long_fetch_add_relaxed(longi,atomic_long_t*v)¶
atomic add with relaxed ordering
Parameters
longilong value to add
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v +i) with relaxed ordering.
Safe to use in noinstr code; preferatomic_long_fetch_add_relaxed() elsewhere.
Return
The original value ofv.
- voidraw_atomic_long_sub(longi,atomic_long_t*v)¶
atomic subtract with relaxed ordering
Parameters
longilong value to subtract
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v -i) with relaxed ordering.
Safe to use in noinstr code; preferatomic_long_sub() elsewhere.
Return
Nothing.
- longraw_atomic_long_sub_return(longi,atomic_long_t*v)¶
atomic subtract with full ordering
Parameters
longilong value to subtract
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v -i) with full ordering.
Safe to use in noinstr code; preferatomic_long_sub_return() elsewhere.
Return
The updated value ofv.
- longraw_atomic_long_sub_return_acquire(longi,atomic_long_t*v)¶
atomic subtract with acquire ordering
Parameters
longilong value to subtract
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v -i) with acquire ordering.
Safe to use in noinstr code; preferatomic_long_sub_return_acquire() elsewhere.
Return
The updated value ofv.
- longraw_atomic_long_sub_return_release(longi,atomic_long_t*v)¶
atomic subtract with release ordering
Parameters
longilong value to subtract
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v -i) with release ordering.
Safe to use in noinstr code; preferatomic_long_sub_return_release() elsewhere.
Return
The updated value ofv.
- longraw_atomic_long_sub_return_relaxed(longi,atomic_long_t*v)¶
atomic subtract with relaxed ordering
Parameters
longilong value to subtract
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v -i) with relaxed ordering.
Safe to use in noinstr code; preferatomic_long_sub_return_relaxed() elsewhere.
Return
The updated value ofv.
- longraw_atomic_long_fetch_sub(longi,atomic_long_t*v)¶
atomic subtract with full ordering
Parameters
longilong value to subtract
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v -i) with full ordering.
Safe to use in noinstr code; preferatomic_long_fetch_sub() elsewhere.
Return
The original value ofv.
- longraw_atomic_long_fetch_sub_acquire(longi,atomic_long_t*v)¶
atomic subtract with acquire ordering
Parameters
longilong value to subtract
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v -i) with acquire ordering.
Safe to use in noinstr code; preferatomic_long_fetch_sub_acquire() elsewhere.
Return
The original value ofv.
- longraw_atomic_long_fetch_sub_release(longi,atomic_long_t*v)¶
atomic subtract with release ordering
Parameters
longilong value to subtract
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v -i) with release ordering.
Safe to use in noinstr code; preferatomic_long_fetch_sub_release() elsewhere.
Return
The original value ofv.
- longraw_atomic_long_fetch_sub_relaxed(longi,atomic_long_t*v)¶
atomic subtract with relaxed ordering
Parameters
longilong value to subtract
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v -i) with relaxed ordering.
Safe to use in noinstr code; preferatomic_long_fetch_sub_relaxed() elsewhere.
Return
The original value ofv.
- voidraw_atomic_long_inc(atomic_long_t*v)¶
atomic increment with relaxed ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v + 1) with relaxed ordering.
Safe to use in noinstr code; preferatomic_long_inc() elsewhere.
Return
Nothing.
- longraw_atomic_long_inc_return(atomic_long_t*v)¶
atomic increment with full ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v + 1) with full ordering.
Safe to use in noinstr code; preferatomic_long_inc_return() elsewhere.
Return
The updated value ofv.
- longraw_atomic_long_inc_return_acquire(atomic_long_t*v)¶
atomic increment with acquire ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v + 1) with acquire ordering.
Safe to use in noinstr code; preferatomic_long_inc_return_acquire() elsewhere.
Return
The updated value ofv.
- longraw_atomic_long_inc_return_release(atomic_long_t*v)¶
atomic increment with release ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v + 1) with release ordering.
Safe to use in noinstr code; preferatomic_long_inc_return_release() elsewhere.
Return
The updated value ofv.
- longraw_atomic_long_inc_return_relaxed(atomic_long_t*v)¶
atomic increment with relaxed ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v + 1) with relaxed ordering.
Safe to use in noinstr code; preferatomic_long_inc_return_relaxed() elsewhere.
Return
The updated value ofv.
- longraw_atomic_long_fetch_inc(atomic_long_t*v)¶
atomic increment with full ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v + 1) with full ordering.
Safe to use in noinstr code; preferatomic_long_fetch_inc() elsewhere.
Return
The original value ofv.
- longraw_atomic_long_fetch_inc_acquire(atomic_long_t*v)¶
atomic increment with acquire ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v + 1) with acquire ordering.
Safe to use in noinstr code; preferatomic_long_fetch_inc_acquire() elsewhere.
Return
The original value ofv.
- longraw_atomic_long_fetch_inc_release(atomic_long_t*v)¶
atomic increment with release ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v + 1) with release ordering.
Safe to use in noinstr code; preferatomic_long_fetch_inc_release() elsewhere.
Return
The original value ofv.
- longraw_atomic_long_fetch_inc_relaxed(atomic_long_t*v)¶
atomic increment with relaxed ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v + 1) with relaxed ordering.
Safe to use in noinstr code; preferatomic_long_fetch_inc_relaxed() elsewhere.
Return
The original value ofv.
- voidraw_atomic_long_dec(atomic_long_t*v)¶
atomic decrement with relaxed ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v - 1) with relaxed ordering.
Safe to use in noinstr code; preferatomic_long_dec() elsewhere.
Return
Nothing.
- longraw_atomic_long_dec_return(atomic_long_t*v)¶
atomic decrement with full ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v - 1) with full ordering.
Safe to use in noinstr code; preferatomic_long_dec_return() elsewhere.
Return
The updated value ofv.
- longraw_atomic_long_dec_return_acquire(atomic_long_t*v)¶
atomic decrement with acquire ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v - 1) with acquire ordering.
Safe to use in noinstr code; preferatomic_long_dec_return_acquire() elsewhere.
Return
The updated value ofv.
- longraw_atomic_long_dec_return_release(atomic_long_t*v)¶
atomic decrement with release ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v - 1) with release ordering.
Safe to use in noinstr code; preferatomic_long_dec_return_release() elsewhere.
Return
The updated value ofv.
- longraw_atomic_long_dec_return_relaxed(atomic_long_t*v)¶
atomic decrement with relaxed ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v - 1) with relaxed ordering.
Safe to use in noinstr code; preferatomic_long_dec_return_relaxed() elsewhere.
Return
The updated value ofv.
- longraw_atomic_long_fetch_dec(atomic_long_t*v)¶
atomic decrement with full ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v - 1) with full ordering.
Safe to use in noinstr code; preferatomic_long_fetch_dec() elsewhere.
Return
The original value ofv.
- longraw_atomic_long_fetch_dec_acquire(atomic_long_t*v)¶
atomic decrement with acquire ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v - 1) with acquire ordering.
Safe to use in noinstr code; preferatomic_long_fetch_dec_acquire() elsewhere.
Return
The original value ofv.
- longraw_atomic_long_fetch_dec_release(atomic_long_t*v)¶
atomic decrement with release ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v - 1) with release ordering.
Safe to use in noinstr code; preferatomic_long_fetch_dec_release() elsewhere.
Return
The original value ofv.
- longraw_atomic_long_fetch_dec_relaxed(atomic_long_t*v)¶
atomic decrement with relaxed ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v - 1) with relaxed ordering.
Safe to use in noinstr code; preferatomic_long_fetch_dec_relaxed() elsewhere.
Return
The original value ofv.
- voidraw_atomic_long_and(longi,atomic_long_t*v)¶
atomic bitwise AND with relaxed ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v &i) with relaxed ordering.
Safe to use in noinstr code; preferatomic_long_and() elsewhere.
Return
Nothing.
- longraw_atomic_long_fetch_and(longi,atomic_long_t*v)¶
atomic bitwise AND with full ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v &i) with full ordering.
Safe to use in noinstr code; preferatomic_long_fetch_and() elsewhere.
Return
The original value ofv.
- longraw_atomic_long_fetch_and_acquire(longi,atomic_long_t*v)¶
atomic bitwise AND with acquire ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v &i) with acquire ordering.
Safe to use in noinstr code; preferatomic_long_fetch_and_acquire() elsewhere.
Return
The original value ofv.
- longraw_atomic_long_fetch_and_release(longi,atomic_long_t*v)¶
atomic bitwise AND with release ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v &i) with release ordering.
Safe to use in noinstr code; preferatomic_long_fetch_and_release() elsewhere.
Return
The original value ofv.
- longraw_atomic_long_fetch_and_relaxed(longi,atomic_long_t*v)¶
atomic bitwise AND with relaxed ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v &i) with relaxed ordering.
Safe to use in noinstr code; preferatomic_long_fetch_and_relaxed() elsewhere.
Return
The original value ofv.
- voidraw_atomic_long_andnot(longi,atomic_long_t*v)¶
atomic bitwise AND NOT with relaxed ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v &~i) with relaxed ordering.
Safe to use in noinstr code; preferatomic_long_andnot() elsewhere.
Return
Nothing.
- longraw_atomic_long_fetch_andnot(longi,atomic_long_t*v)¶
atomic bitwise AND NOT with full ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v &~i) with full ordering.
Safe to use in noinstr code; preferatomic_long_fetch_andnot() elsewhere.
Return
The original value ofv.
- longraw_atomic_long_fetch_andnot_acquire(longi,atomic_long_t*v)¶
atomic bitwise AND NOT with acquire ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v &~i) with acquire ordering.
Safe to use in noinstr code; preferatomic_long_fetch_andnot_acquire() elsewhere.
Return
The original value ofv.
- longraw_atomic_long_fetch_andnot_release(longi,atomic_long_t*v)¶
atomic bitwise AND NOT with release ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v &~i) with release ordering.
Safe to use in noinstr code; preferatomic_long_fetch_andnot_release() elsewhere.
Return
The original value ofv.
- longraw_atomic_long_fetch_andnot_relaxed(longi,atomic_long_t*v)¶
atomic bitwise AND NOT with relaxed ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v &~i) with relaxed ordering.
Safe to use in noinstr code; preferatomic_long_fetch_andnot_relaxed() elsewhere.
Return
The original value ofv.
- voidraw_atomic_long_or(longi,atomic_long_t*v)¶
atomic bitwise OR with relaxed ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v |i) with relaxed ordering.
Safe to use in noinstr code; preferatomic_long_or() elsewhere.
Return
Nothing.
- longraw_atomic_long_fetch_or(longi,atomic_long_t*v)¶
atomic bitwise OR with full ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v |i) with full ordering.
Safe to use in noinstr code; preferatomic_long_fetch_or() elsewhere.
Return
The original value ofv.
- longraw_atomic_long_fetch_or_acquire(longi,atomic_long_t*v)¶
atomic bitwise OR with acquire ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v |i) with acquire ordering.
Safe to use in noinstr code; preferatomic_long_fetch_or_acquire() elsewhere.
Return
The original value ofv.
- longraw_atomic_long_fetch_or_release(longi,atomic_long_t*v)¶
atomic bitwise OR with release ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v |i) with release ordering.
Safe to use in noinstr code; preferatomic_long_fetch_or_release() elsewhere.
Return
The original value ofv.
- longraw_atomic_long_fetch_or_relaxed(longi,atomic_long_t*v)¶
atomic bitwise OR with relaxed ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v |i) with relaxed ordering.
Safe to use in noinstr code; preferatomic_long_fetch_or_relaxed() elsewhere.
Return
The original value ofv.
- voidraw_atomic_long_xor(longi,atomic_long_t*v)¶
atomic bitwise XOR with relaxed ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v ^i) with relaxed ordering.
Safe to use in noinstr code; preferatomic_long_xor() elsewhere.
Return
Nothing.
- longraw_atomic_long_fetch_xor(longi,atomic_long_t*v)¶
atomic bitwise XOR with full ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v ^i) with full ordering.
Safe to use in noinstr code; preferatomic_long_fetch_xor() elsewhere.
Return
The original value ofv.
- longraw_atomic_long_fetch_xor_acquire(longi,atomic_long_t*v)¶
atomic bitwise XOR with acquire ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v ^i) with acquire ordering.
Safe to use in noinstr code; preferatomic_long_fetch_xor_acquire() elsewhere.
Return
The original value ofv.
- longraw_atomic_long_fetch_xor_release(longi,atomic_long_t*v)¶
atomic bitwise XOR with release ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v ^i) with release ordering.
Safe to use in noinstr code; preferatomic_long_fetch_xor_release() elsewhere.
Return
The original value ofv.
- longraw_atomic_long_fetch_xor_relaxed(longi,atomic_long_t*v)¶
atomic bitwise XOR with relaxed ordering
Parameters
longilong value
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v ^i) with relaxed ordering.
Safe to use in noinstr code; preferatomic_long_fetch_xor_relaxed() elsewhere.
Return
The original value ofv.
- longraw_atomic_long_xchg(atomic_long_t*v,longnew)¶
atomic exchange with full ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
longnewlong value to assign
Description
Atomically updatesv tonew with full ordering.
Safe to use in noinstr code; preferatomic_long_xchg() elsewhere.
Return
The original value ofv.
- longraw_atomic_long_xchg_acquire(atomic_long_t*v,longnew)¶
atomic exchange with acquire ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
longnewlong value to assign
Description
Atomically updatesv tonew with acquire ordering.
Safe to use in noinstr code; preferatomic_long_xchg_acquire() elsewhere.
Return
The original value ofv.
- longraw_atomic_long_xchg_release(atomic_long_t*v,longnew)¶
atomic exchange with release ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
longnewlong value to assign
Description
Atomically updatesv tonew with release ordering.
Safe to use in noinstr code; preferatomic_long_xchg_release() elsewhere.
Return
The original value ofv.
- longraw_atomic_long_xchg_relaxed(atomic_long_t*v,longnew)¶
atomic exchange with relaxed ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
longnewlong value to assign
Description
Atomically updatesv tonew with relaxed ordering.
Safe to use in noinstr code; preferatomic_long_xchg_relaxed() elsewhere.
Return
The original value ofv.
- longraw_atomic_long_cmpxchg(atomic_long_t*v,longold,longnew)¶
atomic compare and exchange with full ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
longoldlong value to compare with
longnewlong value to assign
Description
If (v ==old), atomically updatesv tonew with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic_long_cmpxchg() elsewhere.
Return
The original value ofv.
- longraw_atomic_long_cmpxchg_acquire(atomic_long_t*v,longold,longnew)¶
atomic compare and exchange with acquire ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
longoldlong value to compare with
longnewlong value to assign
Description
If (v ==old), atomically updatesv tonew with acquire ordering.Otherwise,v is not modified and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic_long_cmpxchg_acquire() elsewhere.
Return
The original value ofv.
- longraw_atomic_long_cmpxchg_release(atomic_long_t*v,longold,longnew)¶
atomic compare and exchange with release ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
longoldlong value to compare with
longnewlong value to assign
Description
If (v ==old), atomically updatesv tonew with release ordering.Otherwise,v is not modified and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic_long_cmpxchg_release() elsewhere.
Return
The original value ofv.
- longraw_atomic_long_cmpxchg_relaxed(atomic_long_t*v,longold,longnew)¶
atomic compare and exchange with relaxed ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
longoldlong value to compare with
longnewlong value to assign
Description
If (v ==old), atomically updatesv tonew with relaxed ordering.Otherwise,v is not modified and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic_long_cmpxchg_relaxed() elsewhere.
Return
The original value ofv.
- boolraw_atomic_long_try_cmpxchg(atomic_long_t*v,long*old,longnew)¶
atomic compare and exchange with full ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
long*oldpointer to long value to compare with
longnewlong value to assign
Description
If (v ==old), atomically updatesv tonew with full ordering.Otherwise,v is not modified,old is updated to the current value ofv,and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic_long_try_cmpxchg() elsewhere.
Return
true if the exchange occured,false otherwise.
- boolraw_atomic_long_try_cmpxchg_acquire(atomic_long_t*v,long*old,longnew)¶
atomic compare and exchange with acquire ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
long*oldpointer to long value to compare with
longnewlong value to assign
Description
If (v ==old), atomically updatesv tonew with acquire ordering.Otherwise,v is not modified,old is updated to the current value ofv,and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic_long_try_cmpxchg_acquire() elsewhere.
Return
true if the exchange occured,false otherwise.
- boolraw_atomic_long_try_cmpxchg_release(atomic_long_t*v,long*old,longnew)¶
atomic compare and exchange with release ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
long*oldpointer to long value to compare with
longnewlong value to assign
Description
If (v ==old), atomically updatesv tonew with release ordering.Otherwise,v is not modified,old is updated to the current value ofv,and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic_long_try_cmpxchg_release() elsewhere.
Return
true if the exchange occured,false otherwise.
- boolraw_atomic_long_try_cmpxchg_relaxed(atomic_long_t*v,long*old,longnew)¶
atomic compare and exchange with relaxed ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
long*oldpointer to long value to compare with
longnewlong value to assign
Description
If (v ==old), atomically updatesv tonew with relaxed ordering.Otherwise,v is not modified,old is updated to the current value ofv,and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic_long_try_cmpxchg_relaxed() elsewhere.
Return
true if the exchange occured,false otherwise.
- boolraw_atomic_long_sub_and_test(longi,atomic_long_t*v)¶
atomic subtract and test if zero with full ordering
Parameters
longilong value to subtract
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v -i) with full ordering.
Safe to use in noinstr code; preferatomic_long_sub_and_test() elsewhere.
Return
true if the resulting value ofv is zero,false otherwise.
- boolraw_atomic_long_dec_and_test(atomic_long_t*v)¶
atomic decrement and test if zero with full ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v - 1) with full ordering.
Safe to use in noinstr code; preferatomic_long_dec_and_test() elsewhere.
Return
true if the resulting value ofv is zero,false otherwise.
- boolraw_atomic_long_inc_and_test(atomic_long_t*v)¶
atomic increment and test if zero with full ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v + 1) with full ordering.
Safe to use in noinstr code; preferatomic_long_inc_and_test() elsewhere.
Return
true if the resulting value ofv is zero,false otherwise.
- boolraw_atomic_long_add_negative(longi,atomic_long_t*v)¶
atomic add and test if negative with full ordering
Parameters
longilong value to add
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v +i) with full ordering.
Safe to use in noinstr code; preferatomic_long_add_negative() elsewhere.
Return
true if the resulting value ofv is negative,false otherwise.
- boolraw_atomic_long_add_negative_acquire(longi,atomic_long_t*v)¶
atomic add and test if negative with acquire ordering
Parameters
longilong value to add
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v +i) with acquire ordering.
Safe to use in noinstr code; preferatomic_long_add_negative_acquire() elsewhere.
Return
true if the resulting value ofv is negative,false otherwise.
- boolraw_atomic_long_add_negative_release(longi,atomic_long_t*v)¶
atomic add and test if negative with release ordering
Parameters
longilong value to add
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v +i) with release ordering.
Safe to use in noinstr code; preferatomic_long_add_negative_release() elsewhere.
Return
true if the resulting value ofv is negative,false otherwise.
- boolraw_atomic_long_add_negative_relaxed(longi,atomic_long_t*v)¶
atomic add and test if negative with relaxed ordering
Parameters
longilong value to add
atomic_long_t*vpointer to atomic_long_t
Description
Atomically updatesv to (v +i) with relaxed ordering.
Safe to use in noinstr code; preferatomic_long_add_negative_relaxed() elsewhere.
Return
true if the resulting value ofv is negative,false otherwise.
- longraw_atomic_long_fetch_add_unless(atomic_long_t*v,longa,longu)¶
atomic add unless value with full ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
longalong value to add
longulong value to compare with
Description
If (v !=u), atomically updatesv to (v +a) with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic_long_fetch_add_unless() elsewhere.
Return
The original value ofv.
- boolraw_atomic_long_add_unless(atomic_long_t*v,longa,longu)¶
atomic add unless value with full ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
longalong value to add
longulong value to compare with
Description
If (v !=u), atomically updatesv to (v +a) with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic_long_add_unless() elsewhere.
Return
true ifv was updated,false otherwise.
- boolraw_atomic_long_inc_not_zero(atomic_long_t*v)¶
atomic increment unless zero with full ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
If (v != 0), atomically updatesv to (v + 1) with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic_long_inc_not_zero() elsewhere.
Return
true ifv was updated,false otherwise.
- boolraw_atomic_long_inc_unless_negative(atomic_long_t*v)¶
atomic increment unless negative with full ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
If (v >= 0), atomically updatesv to (v + 1) with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic_long_inc_unless_negative() elsewhere.
Return
true ifv was updated,false otherwise.
- boolraw_atomic_long_dec_unless_positive(atomic_long_t*v)¶
atomic decrement unless positive with full ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
If (v <= 0), atomically updatesv to (v - 1) with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic_long_dec_unless_positive() elsewhere.
Return
true ifv was updated,false otherwise.
- longraw_atomic_long_dec_if_positive(atomic_long_t*v)¶
atomic decrement if positive with full ordering
Parameters
atomic_long_t*vpointer to atomic_long_t
Description
If (v > 0), atomically updatesv to (v - 1) with full ordering.Otherwise,v is not modified and relaxed ordering is provided.
Safe to use in noinstr code; preferatomic_long_dec_if_positive() elsewhere.
Return
The old value of (v - 1), regardless of whetherv was updated.
Kernel objects manipulation¶
- char*kobject_get_path(conststructkobject*kobj,gfp_tgfp_mask)¶
Allocate memory and fill in the path forkobj.
Parameters
conststructkobject*kobjkobject in question, with which to build the path
gfp_tgfp_maskthe allocation type used to allocate the path
Return
The newly allocated memory, caller must free withkfree().
- intkobject_set_name(structkobject*kobj,constchar*fmt,...)¶
Set the name of a kobject.
Parameters
structkobject*kobjstructkobjectto set the name ofconstchar*fmtformat string used to build the name
...variable arguments
Description
This sets the name of the kobject. If you have already added thekobject to the system, you must callkobject_rename() in order tochange the name of the kobject.
- voidkobject_init(structkobject*kobj,conststructkobj_type*ktype)¶
Initialize a kobject structure.
Parameters
structkobject*kobjpointer to the kobject to initialize
conststructkobj_type*ktypepointer to the ktype for this kobject.
Description
This function will properly initialize a kobject such that it can thenbe passed to thekobject_add() call.
After this function is called, the kobject MUST be cleaned up by a calltokobject_put(), not by a call to kfree directly to ensure that all ofthe memory is cleaned up properly.
- intkobject_add(structkobject*kobj,structkobject*parent,constchar*fmt,...)¶
The main kobject add function.
Parameters
structkobject*kobjthe kobject to add
structkobject*parentpointer to the parent of the kobject.
constchar*fmtformat to name the kobject with.
...variable arguments
Description
The kobject name is set and added to the kobject hierarchy in thisfunction.
Ifparent is set, then the parent of thekobj will be set to it.Ifparent is NULL, then the parent of thekobj will be set to thekobject associated with the kset assigned to this kobject. If no ksetis assigned to the kobject, then the kobject will be located in theroot of the sysfs tree.
Note, no “add” uevent will be created with this call, the caller should setup all of the necessary sysfs files for the object and then callkobject_uevent() with the UEVENT_ADD parameter to ensure thatuserspace is properly notified of this kobject’s creation.
If this function returns success,
kobject_put()must also be calledin order to properly clean up the memory associated with the object.In short, once this function is called,
kobject_put()MUST be calledwhen the use of the object is finished in order to properly freeeverything.
Return
If this function returns an error,kobject_put() must becalled to properly clean up the memory associated with theobject. Under no instance should the kobject that is passedto this function be directly freed with a call tokfree(),that can leak memory.
- intkobject_init_and_add(structkobject*kobj,conststructkobj_type*ktype,structkobject*parent,constchar*fmt,...)¶
Initialize a kobject structure and add it to the kobject hierarchy.
Parameters
structkobject*kobjpointer to the kobject to initialize
conststructkobj_type*ktypepointer to the ktype for this kobject.
structkobject*parentpointer to the parent of this kobject.
constchar*fmtthe name of the kobject.
...variable arguments
Description
This function combines the call tokobject_init() andkobject_add().
If this function returns an error,kobject_put() must be called toproperly clean up the memory associated with the object. This is thesame type of error handling after a call tokobject_add() and kobjectlifetime rules are the same here.
- intkobject_rename(structkobject*kobj,constchar*new_name)¶
Change the name of an object.
Parameters
structkobject*kobjobject in question.
constchar*new_nameobject’s new name
Description
It is the responsibility of the caller to provide mutualexclusion between two different calls of kobject_renameon the same kobject and to ensure that new_name is valid andwon’t conflict with other kobjects.
- intkobject_move(structkobject*kobj,structkobject*new_parent)¶
Move object to another parent.
Parameters
structkobject*kobjobject in question.
structkobject*new_parentobject’s new parent (can be NULL)
- voidkobject_del(structkobject*kobj)¶
Unlink kobject from hierarchy.
Parameters
structkobject*kobjobject.
Description
This is the function that should be called to delete an objectsuccessfully added viakobject_add().
- structkobject*kobject_get(structkobject*kobj)¶
Increment refcount for object.
Parameters
structkobject*kobjobject.
- voidkobject_put(structkobject*kobj)¶
Decrement refcount for object.
Parameters
structkobject*kobjobject.
Description
Decrement the refcount, and if 0, callkobject_cleanup().
- structkobject*kobject_create_and_add(constchar*name,structkobject*parent)¶
Create a
structkobjectdynamically and register it with sysfs.
Parameters
constchar*namethe name for the kobject
structkobject*parentthe parent kobject of this kobject, if any.
Description
This function creates a kobject structure dynamically and registers itwith sysfs. When you are finished with this structure, callkobject_put() and the structure will be dynamically freed whenit is no longer being used.
If the kobject was not able to be created, NULL will be returned.
- intkset_register(structkset*k)¶
Initialize and add a kset.
Parameters
structkset*kkset.
NOTE
On error, the kset.kobj.name allocatedby()kobj_set_name()is freed, it can not be used any more.
- voidkset_unregister(structkset*k)¶
Remove a kset.
Parameters
structkset*kkset.
Parameters
structkset*ksetkset we’re looking in.
constchar*nameobject’s name.
Description
Lock kset viakset->subsys, and iterate overkset->list,looking for a matching kobject. If matching object is foundtake a reference and return the object.
- structkset*kset_create_and_add(constchar*name,conststructkset_uevent_ops*uevent_ops,structkobject*parent_kobj)¶
Create a
structksetdynamically and add it to sysfs.
Parameters
constchar*namethe name for the kset
conststructkset_uevent_ops*uevent_opsa
structkset_uevent_opsfor the ksetstructkobject*parent_kobjthe parent kobject of this kset, if any.
Description
This function creates a kset structure dynamically and registers itwith sysfs. When you are finished with this structure, callkset_unregister() and the structure will be dynamically freed when itis no longer being used.
If the kset was not able to be created, NULL will be returned.
- intkobject_uevent_env(structkobject*kobj,enumkobject_actionaction,char*envp_ext[])¶
send an uevent with environmental data
Parameters
structkobject*kobjstructkobjectthat the action is happening toenumkobject_actionactionaction that is happening
char*envp_ext[]pointer to environmental data
Description
Returns 0 ifkobject_uevent_env() is completed with success or thecorresponding error when it fails.
- intkobject_uevent(structkobject*kobj,enumkobject_actionaction)¶
notify userspace by sending an uevent
Parameters
structkobject*kobjstructkobjectthat the action is happening toenumkobject_actionactionaction that is happening
Description
Returns 0 ifkobject_uevent() is completed with success or thecorresponding error when it fails.
- intadd_uevent_var(structkobj_uevent_env*env,constchar*format,...)¶
add key value string to the environment buffer
Parameters
structkobj_uevent_env*envenvironment buffer structure
constchar*formatprintf format for the key=value pair
...variable arguments
Description
Returns 0 if environment variable was added successfully or -ENOMEMif no space was available.
Kernel utility functions¶
- might_sleep¶
might_sleep()
annotation for functions that can sleep
Description
this macro will print a stack trace if it is executed in an atomiccontext (spinlock, irq-handler, ...). Additional sections where blocking isnot allowed can be annotated with
non_block_start()andnon_block_end()pairs.This is a useful debugging help to be able to catch problems early and notbe bitten later when the calling function happens to sleep when it is notsupposed to.
- cant_sleep¶
cant_sleep()
annotation for functions that cannot sleep
Description
this macro will print a stack trace if it is executed with preemption enabled
- cant_migrate¶
cant_migrate()
annotation for functions that cannot migrate
Description
Will print a stack trace if executed in code which is migratable
- non_block_start¶
non_block_start()
annotate the start of section where sleeping is prohibited
Description
This is on behalf of the oom reaper, specifically when it is calling the mmunotifiers. The problem is that if the notifier were to block on, for example,
mutex_lock()and if the process which holds that mutex were to perform asleeping memory allocation, the oom reaper is now blocked on completion ofthat memory allocation. Other blocking calls likewait_event()pose similarissues.
- non_block_end¶
non_block_end()
annotate the end of section where sleeping is prohibited
Description
Closes a section opened by
non_block_start().
- enumsystem_states¶
Values used for system_state.
Constants
SYSTEM_BOOTING0, no init neededSYSTEM_SCHEDULINGsystem is ready for scheduling; OK to use RCU
SYSTEM_FREEING_INITMEMsystem is freeing all of initmem; almost running
SYSTEM_RUNNINGsystem is up and running
SYSTEM_HALTsystem entered clean system halt state
SYSTEM_POWER_OFFsystem entered shutdown/clean power off state
SYSTEM_RESTARTsystem entered emergency power off or normal restart
SYSTEM_SUSPENDsystem entered suspend or hibernate state
Note
Ordering of the states must not be changedas code checks for <, <=, >, >= STATE.
- trace_printk¶
trace_printk(fmt,...)
printf formatting in the ftrace buffer
Parameters
fmtthe printf format for printing
...variable arguments
Note
- __trace_printk is an internal function for trace_printk() and
theip is passed in via the
trace_printk()macro.
This function allows a kernel developer to debug fast path sectionsthat printk is not appropriate for. By scattering in variousprintk like tracing in the code, a developer can quickly seewhere problems are occurring.
This is intended as a debugging tool for the developer only.Please refrain from leaving trace_printks scattered around inyour code. (Extra memory is used for special buffers that areallocated whentrace_printk() is used.)
A little optimization trick is done here. If there’s only oneargument, there’s no need to scan the string for printf formats.Thetrace_puts() will suffice. But how can we take advantage ofusingtrace_puts() whentrace_printk() has only one argument?By stringifying the args and checking the size we can tellwhether or not there are args. __stringify((__VA_ARGS__)) willturn into “()0” with a size of 3 when there are no args, anythingelse will be bigger. All we need to do is define a string to this,and then take its size and compare to 3. If it’s bigger, usedo_trace_printk() otherwise, optimize it totrace_puts(). Then justlet gcc optimize the rest.
- trace_puts¶
trace_puts(str)
write a string into the ftrace buffer
Parameters
strthe string to record
Note
- __trace_bputs is an internal function for trace_puts and
theip is passed in via the trace_puts macro.
This is similar totrace_printk() but is made for those really fastpaths that a developer wants the least amount of “Heisenbug” effects,where the processing of the print format is still too much.
This function allows a kernel developer to debug fast path sectionsthat printk is not appropriate for. By scattering in variousprintk like tracing in the code, a developer can quickly seewhere problems are occurring.
This is intended as a debugging tool for the developer only.Please refrain from leaving trace_puts scattered around inyour code. (Extra memory is used for special buffers that areallocated whentrace_puts() is used.)
Return
0 if nothing was written, positive # if string was.(1 when __trace_bputs is used, strlen(str) when __trace_puts is used)
- voidconsole_list_lock(void)¶
Lock the console list
Parameters
voidno arguments
Description
For console list or console->flags updates
- voidconsole_list_unlock(void)¶
Unlock the console list
- intconsole_srcu_read_lock(void)¶
Register a new reader for the SRCU-protected console list
Parameters
voidno arguments
Description
Usefor_each_console_srcu() to iterate the console list
Context
Any context.
Return
A cookie to pass toconsole_srcu_read_unlock().
- voidconsole_srcu_read_unlock(intcookie)¶
Unregister an old reader from the SRCU-protected console list
Parameters
intcookiecookie returned from
console_srcu_read_lock()
Description
Counterpart toconsole_srcu_read_lock()
- intmatch_devname_and_update_preferred_console(constchar*devname,constchar*name,constshortidx)¶
Update a preferred console when matching devname is found.
Parameters
constchar*devnameDEVNAME:0.0 style device name
constchar*nameName of the corresponding console driver, e.g. “ttyS”
constshortidxConsole index, e.g. port number.
Description
The function checks whether a device with the givendevname ispreferred via the console=DEVNAME:0.0 command line option.It fills the missing console driver name and console indexso that a laterregister_console() call could find (match)and enable this device.
It might be used when a driver subsystem initializes particulardevices with already known DEVNAME:0.0 style names. And itcould predict which console driver name and index this devicewould later get associated with.
Return
0 on success, negative error code on failure.
- voidconsole_lock(void)¶
block the console subsystem from printing
Parameters
voidno arguments
Description
Acquires a lock which guarantees that no consoles willbe in or enter their write() callback.
Can sleep, returns nothing.
- intconsole_trylock(void)¶
try to block the console subsystem from printing
Parameters
voidno arguments
Description
Try to acquire a lock which guarantees that no consoles willbe in or enter their write() callback.
returns 1 on success, and 0 on failure to acquire the lock.
- voidconsole_unlock(void)¶
unblock the legacy console subsystem from printing
Parameters
voidno arguments
Description
Releases the console_lock which the caller holds to block printing ofthe legacy console subsystem.
While the console_lock was held, console output may have been bufferedbyprintk(). If this is the case,console_unlock() emits the output onlegacy consoles prior to releasing the lock.
console_unlock(); may be called from any context.
- voidconsole_conditional_schedule(void)¶
yield the CPU if required
Parameters
voidno arguments
Description
If the console code is currently allowed to sleep, andif this CPU should yield the CPU to another task, doso here.
Must be called withinconsole_lock();.
Parameters
structconsole*conThe registered console to force preferred.
Description
Must be called underconsole_list_lock().
- boolprintk_timed_ratelimit(unsignedlong*caller_jiffies,unsignedintinterval_msecs)¶
caller-controlled printk ratelimiting
Parameters
unsignedlong*caller_jiffiespointer to caller’s state
unsignedintinterval_msecsminimum interval between prints
Description
printk_timed_ratelimit() returns true if more thaninterval_msecsmilliseconds have elapsed since the last timeprintk_timed_ratelimit()returned true.
- intkmsg_dump_register(structkmsg_dumper*dumper)¶
register a kernel log dumper.
Parameters
structkmsg_dumper*dumperpointer to the kmsg_dumper structure
Description
Adds a kernel log dumper to the system. The dump callback in thestructure will be called when the kernel oopses or panics and must beset. Returns zero on success and-EINVAL or-EBUSY otherwise.
- intkmsg_dump_unregister(structkmsg_dumper*dumper)¶
unregister a kmsg dumper.
Parameters
structkmsg_dumper*dumperpointer to the kmsg_dumper structure
Description
Removes a dump device from the system. Returns zero on success and-EINVAL otherwise.
- boolkmsg_dump_get_line(structkmsg_dump_iter*iter,boolsyslog,char*line,size_tsize,size_t*len)¶
retrieve one kmsg log line
Parameters
structkmsg_dump_iter*iterkmsg dump iterator
boolsysloginclude the “<4>” prefixes
char*linebuffer to copy the line to
size_tsizemaximum size of the buffer
size_t*lenlength of line placed into buffer
Description
Start at the beginning of the kmsg buffer, with the oldest kmsgrecord, and copy one record into the provided buffer.
Consecutive calls will return the next available record movingtowards the end of the buffer with the youngest messages.
A return value of FALSE indicates that there are no more records toread.
- boolkmsg_dump_get_buffer(structkmsg_dump_iter*iter,boolsyslog,char*buf,size_tsize,size_t*len_out)¶
copy kmsg log lines
Parameters
structkmsg_dump_iter*iterkmsg dump iterator
boolsysloginclude the “<4>” prefixes
char*bufbuffer to copy the line to
size_tsizemaximum size of the buffer
size_t*len_outlength of line placed into buffer
Description
Start at the end of the kmsg buffer and fill the provided bufferwith as many of theyoungest kmsg records that fit into it.If the buffer is large enough, all available kmsg records will becopied with a single call.
Consecutive calls will fill the buffer with the next block ofavailable older records, not including the earlier retrieved ones.
A return value of FALSE indicates that there are no more records toread.
- voidkmsg_dump_rewind(structkmsg_dump_iter*iter)¶
reset the iterator
Parameters
structkmsg_dump_iter*iterkmsg dump iterator
Description
Reset the dumper’s iterator so thatkmsg_dump_get_line() andkmsg_dump_get_buffer() can be called again and used multipletimes within the same dumper.dump() callback.
- void__printk_cpu_sync_wait(void)¶
Busy wait until the printk cpu-reentrant spinning lock is not owned by any CPU.
Parameters
voidno arguments
Context
Any context.
- int__printk_cpu_sync_try_get(void)¶
Try to acquire the printk cpu-reentrant spinning lock.
Parameters
voidno arguments
Description
If no processor has the lock, the calling processor takes the lock andbecomes the owner. If the calling processor is already the owner of thelock, this function succeeds immediately.
Context
Any context. Expects interrupts to be disabled.
Return
1 on success, otherwise 0.
- void__printk_cpu_sync_put(void)¶
Release the printk cpu-reentrant spinning lock.
Parameters
voidno arguments
Description
The calling processor must be the owner of the lock.
Context
Any context. Expects interrupts to be disabled.
- voidvpanic(constchar*fmt,va_listargs)¶
halt the system
Parameters
constchar*fmtThe text string to print
va_listargsArguments for the format string
Description
Display a message, then perform cleanups. This function never returns.
- voidadd_taint(unsignedflag,enumlockdep_oklockdep_ok)¶
add a taint flag if not already set.
Parameters
unsignedflagone of the TAINT_* constants.
enumlockdep_oklockdep_okwhether lock debugging is still OK.
Description
If something bad has gone wrong, you’ll wantlockdebug_ok = false, but forsome notewortht-but-not-corrupting cases, it can be set to true.
Device Resource Management¶
- void*__devres_alloc_node(dr_release_trelease,size_tsize,gfp_tgfp,intnid,constchar*name)¶
Allocate device resource data
Parameters
dr_release_treleaseRelease function devres will be associated with
size_tsizeAllocation size
gfp_tgfpAllocation flags
intnidNUMA node
constchar*nameName of the resource
Description
Allocate devres ofsize bytes. The allocated area is zeroed, thenassociated withrelease. The returned pointer can be passed toother devres_*() functions.
Return
Pointer to allocated devres on success, NULL on failure.
- voiddevres_for_each_res(structdevice*dev,dr_release_trelease,dr_match_tmatch,void*match_data,void(*fn)(structdevice*,void*,void*),void*data)¶
Resource iterator
Parameters
structdevice*devDevice to iterate resource from
dr_release_treleaseLook for resources associated with this release function
dr_match_tmatchMatch function (optional)
void*match_dataData for the match function
void(*fn)(structdevice*,void*,void*)Function to be called for each matched resource.
void*dataData forfn, the 3rd parameter offn
Description
Callfn for each devres ofdev which is associated withreleaseand for whichmatch returns 1.
Return
void
- voiddevres_free(void*res)¶
Free device resource data
Parameters
void*resPointer to devres data to free
Description
Free devres created withdevres_alloc().
Parameters
structdevice*devDevice to add resource to
void*resResource to register
Description
Register devresres todev.res should have been allocatedusingdevres_alloc(). On driver detach, the associated releasefunction will be invoked and devres will be freed automatically.
- void*devres_find(structdevice*dev,dr_release_trelease,dr_match_tmatch,void*match_data)¶
Find device resource
Parameters
structdevice*devDevice to lookup resource from
dr_release_treleaseLook for resources associated with this release function
dr_match_tmatchMatch function (optional)
void*match_dataData for the match function
Description
Find the latest devres ofdev which is associated withreleaseand for whichmatch returns 1. Ifmatch is NULL, it’s consideredto match all.
Return
Pointer to found devres, NULL if not found.
- void*devres_get(structdevice*dev,void*new_res,dr_match_tmatch,void*match_data)¶
Find devres, if non-existent, add one atomically
Parameters
structdevice*devDevice to lookup or add devres for
void*new_resPointer to new initialized devres to add if not found
dr_match_tmatchMatch function (optional)
void*match_dataData for the match function
Description
Find the latest devres ofdev which has the same release functionasnew_res and for whichmatch return 1. If found,new_res isfreed; otherwise,new_res is added atomically.
Return
Pointer to found or added devres.
- void*devres_remove(structdevice*dev,dr_release_trelease,dr_match_tmatch,void*match_data)¶
Find a device resource and remove it
Parameters
structdevice*devDevice to find resource from
dr_release_treleaseLook for resources associated with this release function
dr_match_tmatchMatch function (optional)
void*match_dataData for the match function
Description
Find the latest devres ofdev associated withrelease and forwhichmatch returns 1. Ifmatch is NULL, it’s considered tomatch all. If found, the resource is removed atomically andreturned.
Return
Pointer to removed devres on success, NULL if not found.
- intdevres_destroy(structdevice*dev,dr_release_trelease,dr_match_tmatch,void*match_data)¶
Find a device resource and destroy it
Parameters
structdevice*devDevice to find resource from
dr_release_treleaseLook for resources associated with this release function
dr_match_tmatchMatch function (optional)
void*match_dataData for the match function
Description
Find the latest devres ofdev associated withrelease and forwhichmatch returns 1. Ifmatch is NULL, it’s considered tomatch all. If found, the resource is removed atomically and freed.
Note that the release function for the resource will not be called,only the devres-allocated data will be freed. The caller becomesresponsible for freeing any other data.
Return
0 if devres is found and freed, -ENOENT if not found.
- intdevres_release(structdevice*dev,dr_release_trelease,dr_match_tmatch,void*match_data)¶
Find a device resource and destroy it, calling release
Parameters
structdevice*devDevice to find resource from
dr_release_treleaseLook for resources associated with this release function
dr_match_tmatchMatch function (optional)
void*match_dataData for the match function
Description
Find the latest devres ofdev associated withrelease and forwhichmatch returns 1. Ifmatch is NULL, it’s considered tomatch all. If found, the resource is removed atomically, therelease function called and the resource freed.
Return
0 if devres is found and freed, -ENOENT if not found.
Parameters
structdevice*devDevice to open devres group for
void*idSeparator ID
gfp_tgfpAllocation flags
Description
Open a new devres group fordev withid. Forid, using apointer to an object which won’t be used for another group isrecommended. Ifid is NULL, address-wise unique ID is created.
Return
ID of the new group, NULL on failure.
Parameters
structdevice*devDevice to close devres group for
void*idID of target group, can be NULL
Description
Close the group identified byid. Ifid is NULL, the latest opengroup is selected.
Parameters
structdevice*devDevice to remove group for
void*idID of target group, can be NULL
Description
Remove the group identified byid. Ifid is NULL, the latestopen group is selected. Note that removing a group doesn’t affectany other resources.
Parameters
structdevice*devDevice to release group for
void*idID of target group, can be NULL
Description
Release all resources in the group identified byid. Ifid isNULL, the latest open group is selected. The selected group andgroups properly nested inside the selected group are removed.
Return
The number of released non-group resources.
- int__devm_add_action(structdevice*dev,void(*action)(void*),void*data,constchar*name)¶
add a custom action to list of managed resources
Parameters
structdevice*devDevice that owns the action
void(*action)(void*)Function that should be called
void*dataPointer to data passed toaction implementation
constchar*nameName of the resource (for debugging purposes)
Description
This adds a custom action to the list of managed resources so thatit gets executed as part of standard resource unwinding.
- intdevm_remove_action_nowarn(structdevice*dev,void(*action)(void*),void*data)¶
removes previously added custom action
Parameters
structdevice*devDevice that owns the action
void(*action)(void*)Function implementing the action
void*dataPointer to data passed toaction implementation
Description
Removes instance ofaction previously added bydevm_add_action().Both action and data should match one of the existing entries.
In contrast todevm_remove_action(), this function does notWARN() if noentry could have been found.
This should only be used if the action is contained in an object withindependent lifetime management, e.g. the Devres rust abstraction.
Causing the warning from regular driver code most likely indicates an abuseof the devres API.
Return
0 on success, -ENOENT if no entry could have been found.
- voiddevm_release_action(structdevice*dev,void(*action)(void*),void*data)¶
release previously added custom action
Parameters
structdevice*devDevice that owns the action
void(*action)(void*)Function implementing the action
void*dataPointer to data passed toaction implementation
Description
Releases and removes instance ofaction previously added bydevm_add_action(). Both action and data should match one of theexisting entries.
Parameters
structdevice*devDevice to allocate memory for
size_tsizeAllocation size
gfp_tgfpAllocation gfp flags
Description
Managed kmalloc. Memory allocated with this function isautomatically freed on driver detach. Like all other devresresources, guaranteed alignment is unsigned long long.
Return
Pointer to allocated memory on success, NULL on failure.
Parameters
structdevice*devDevice to re-allocate memory for
void*ptrPointer to the memory chunk to re-allocate
size_tnew_sizeNew allocation size
gfp_tgfpAllocation gfp flags
Description
Managedkrealloc(). Resizes the memory chunk allocated withdevm_kmalloc().Behaves similarly to regularkrealloc(): ifptr is NULL or ZERO_SIZE_PTR,it’s the equivalent ofdevm_kmalloc(). If new_size is zero, it frees thepreviously allocated memory and returns ZERO_SIZE_PTR. This function doesn’tchange the order in which the release callback for the re-alloc’ed devreswill be called (except when falling back todevm_kmalloc() or when freeingresources when new_size is zero). The contents of the memory are preservedup to the lesser of new and old sizes.
- char*devm_kstrdup(structdevice*dev,constchar*s,gfp_tgfp)¶
Allocate resource managed space and copy an existing string into that.
Parameters
structdevice*devDevice to allocate memory for
constchar*sthe string to duplicate
gfp_tgfpthe GFP mask used in the
devm_kmalloc()call whenallocating memory
Return
Pointer to allocated string on success, NULL on failure.
- constchar*devm_kstrdup_const(structdevice*dev,constchar*s,gfp_tgfp)¶
resource managed conditional string duplication
Parameters
structdevice*devdevice for which to duplicate the string
constchar*sthe string to duplicate
gfp_tgfpthe GFP mask used in the
kmalloc()call when allocating memory
Description
Strings allocated by devm_kstrdup_const will be automatically freed whenthe associated device is detached.
Return
Source string if it is in .rodata section otherwise it falls back todevm_kstrdup.
- char*devm_kvasprintf(structdevice*dev,gfp_tgfp,constchar*fmt,va_listap)¶
Allocate resource managed space and format a string into that.
Parameters
structdevice*devDevice to allocate memory for
gfp_tgfpthe GFP mask used in the
devm_kmalloc()call whenallocating memoryconstchar*fmtThe
printf()-style format stringva_listapArguments for the format string
Return
Pointer to allocated string on success, NULL on failure.
- char*devm_kasprintf(structdevice*dev,gfp_tgfp,constchar*fmt,...)¶
Allocate resource managed space and format a string into that.
Parameters
structdevice*devDevice to allocate memory for
gfp_tgfpthe GFP mask used in the
devm_kmalloc()call whenallocating memoryconstchar*fmtThe
printf()-style format string...Arguments for the format string
Return
Pointer to allocated string on success, NULL on failure.
Parameters
structdevice*devDevice this memory belongs to
constvoid*pMemory to free
Description
Free memory allocated withdevm_kmalloc().
Parameters
structdevice*devDevice this memory belongs to
constvoid*srcMemory region to duplicate
size_tlenMemory region length
gfp_tgfpGFP mask to use
Description
Duplicate region of a memory using resource managed kmalloc
- constvoid*devm_kmemdup_const(structdevice*dev,constvoid*src,size_tlen,gfp_tgfp)¶
conditionally duplicate and manage a region of memory
Parameters
structdevice*devDevice this memory belongs to
constvoid*srcmemory region to duplicate
size_tlenmemory region length,
gfp_tgfpGFP mask to use
Return
source address if it is in .rodata or the return value ofkmemdup()to which the function falls back otherwise.
- unsignedlongdevm_get_free_pages(structdevice*dev,gfp_tgfp_mask,unsignedintorder)¶
Resource-managed __get_free_pages
Parameters
structdevice*devDevice to allocate memory for
gfp_tgfp_maskAllocation gfp flags
unsignedintorderAllocation size is (1 << order) pages
Description
Managed get_free_pages. Memory allocated with this function isautomatically freed on driver detach.
Return
Address of allocated memory on success, 0 on failure.
Parameters
structdevice*devDevice this memory belongs to
unsignedlongaddrMemory to free
Description
Free memory allocated withdevm_get_free_pages(). Unlike free_pages,there is no need to supply theorder.
- void__percpu*__devm_alloc_percpu(structdevice*dev,size_tsize,size_talign)¶
Resource-managed alloc_percpu
Parameters
structdevice*devDevice to allocate per-cpu memory for
size_tsizeSize of per-cpu memory to allocate
size_talignAlignment of per-cpu memory to allocate
Description
Managed alloc_percpu. Per-cpu memory allocated with this function isautomatically freed on driver detach.
Return
Pointer to allocated memory on success, NULL on failure.