JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
man pages section 9: DDI and DKI Kernel Functions     Oracle Solaris 11 Information Library
search filter icon
search icon

Document Information

Preface

Introduction

Kernel Functions for Drivers

adjmsg(9F)

allocb(9F)

allocb_tmpl(9F)

aminphys(9F)

anocancel(9F)

aphysio(9F)

ASSERT(9F)

assert(9F)

atomic_add_16(9F)

atomic_add_16_nv(9F)

atomic_add_32(9F)

atomic_add_32_nv(9F)

atomic_add_64(9F)

atomic_add_64_nv(9F)

atomic_add_8(9F)

atomic_add_8_nv(9F)

atomic_add(9F)

atomic_add_char(9F)

atomic_add_char_nv(9F)

atomic_add_int(9F)

atomic_add_int_nv(9F)

atomic_add_long(9F)

atomic_add_long_nv(9F)

atomic_add_ptr(9F)

atomic_add_ptr_nv(9F)

atomic_add_short(9F)

atomic_add_short_nv(9F)

atomic_and_16(9F)

atomic_and_16_nv(9F)

atomic_and_32(9F)

atomic_and_32_nv(9F)

atomic_and_64(9F)

atomic_and_64_nv(9F)

atomic_and_8(9F)

atomic_and_8_nv(9F)

atomic_and(9F)

atomic_and_uchar(9F)

atomic_and_uchar_nv(9F)

atomic_and_uint(9F)

atomic_and_uint_nv(9F)

atomic_and_ulong(9F)

atomic_and_ulong_nv(9F)

atomic_and_ushort(9F)

atomic_and_ushort_nv(9F)

atomic_bits(9F)

atomic_cas_16(9F)

atomic_cas_32(9F)

atomic_cas_64(9F)

atomic_cas_8(9F)

atomic_cas(9F)

atomic_cas_ptr(9F)

atomic_cas_uchar(9F)

atomic_cas_uint(9F)

atomic_cas_ulong(9F)

atomic_cas_ushort(9F)

atomic_clear_long_excl(9F)

atomic_dec_16(9F)

atomic_dec_16_nv(9F)

atomic_dec_32(9F)

atomic_dec_32_nv(9F)

atomic_dec_64(9F)

atomic_dec_64_nv(9F)

atomic_dec_8(9F)

atomic_dec_8_nv(9F)

atomic_dec(9F)

atomic_dec_ptr(9F)

atomic_dec_ptr_nv(9F)

atomic_dec_uchar(9F)

atomic_dec_uchar_nv(9F)

atomic_dec_uint(9F)

atomic_dec_uint_nv(9F)

atomic_dec_ulong(9F)

atomic_dec_ulong_nv(9F)

atomic_dec_ushort(9F)

atomic_dec_ushort_nv(9F)

atomic_inc_16(9F)

atomic_inc_16_nv(9F)

atomic_inc_32(9F)

atomic_inc_32_nv(9F)

atomic_inc_64(9F)

atomic_inc_64_nv(9F)

atomic_inc_8(9F)

atomic_inc_8_nv(9F)

atomic_inc(9F)

atomic_inc_ptr(9F)

atomic_inc_ptr_nv(9F)

atomic_inc_uchar(9F)

atomic_inc_uchar_nv(9F)

atomic_inc_uint(9F)

atomic_inc_uint_nv(9F)

atomic_inc_ulong(9F)

atomic_inc_ulong_nv(9F)

atomic_inc_ushort(9F)

atomic_inc_ushort_nv(9F)

atomic_ops(9F)

atomic_or_16(9F)

atomic_or_16_nv(9F)

atomic_or_32(9F)

atomic_or_32_nv(9F)

atomic_or_64(9F)

atomic_or_64_nv(9F)

atomic_or_8(9F)

atomic_or_8_nv(9F)

atomic_or(9F)

atomic_or_uchar(9F)

atomic_or_uchar_nv(9F)

atomic_or_uint(9F)

atomic_or_uint_nv(9F)

atomic_or_ulong(9F)

atomic_or_ulong_nv(9F)

atomic_or_ushort(9F)

atomic_or_ushort_nv(9F)

atomic_set_long_excl(9F)

atomic_swap_16(9F)

atomic_swap_32(9F)

atomic_swap_64(9F)

atomic_swap_8(9F)

atomic_swap(9F)

atomic_swap_ptr(9F)

atomic_swap_uchar(9F)

atomic_swap_uint(9F)

atomic_swap_ulong(9F)

atomic_swap_ushort(9F)

audio_control_read(9F)

audio_control_write(9F)

audio_dev_add_control(9F)

audio_dev_add_engine(9F)

audio_dev_add_info(9F)

audio_dev_add_soft_volume(9F)

audio_dev_alloc(9F)

audio_dev_del_control(9F)

audio_dev_free(9F)

audio_dev_register(9F)

audio_dev_remove_engine(9F)

audio_dev_resume(9F)

audio_dev_set_description(9F)

audio_dev_set_version(9F)

audio_dev_suspend(9F)

audio_dev_unregister(9F)

audio_dev_update_controls(9F)

audio_dev_warn(9F)

audio_engine_alloc(9F)

audio_engine_free(9F)

audio_engine_get_private(9F)

audio_engine_set_private(9F)

audio_fini_ops(9F)

audio_init_ops(9F)

backq(9F)

bcanput(9F)

bcanputnext(9F)

bcmp(9F)

bcopy(9F)

bioaligned(9F)

bioclone(9F)

biodone(9F)

bioerror(9F)

biofini(9F)

bioinit(9F)

biomodified(9F)

bioreset(9F)

biosize(9F)

biowait(9F)

bp_copyin(9F)

bp_copyout(9F)

bp_mapin(9F)

bp_mapout(9F)

btop(9F)

btopr(9F)

bufcall(9F)

bzero(9F)

canput(9F)

canputnext(9F)

CIRCLEQ_EMPTY(9F)

CIRCLEQ_ENTRY(9F)

CIRCLEQ_FIRST(9F)

CIRCLEQ_FOREACH(9F)

CIRCLEQ_FOREACH_REVERSE(9F)

CIRCLEQ_HEAD(9F)

CIRCLEQ_HEAD_INITIALIZER(9F)

CIRCLEQ_INIT(9F)

CIRCLEQ_INSERT_AFTER(9F)

CIRCLEQ_INSERT_BEFORE(9F)

CIRCLEQ_INSERT_HEAD(9F)

CIRCLEQ_INSERT_TAIL(9F)

CIRCLEQ_LAST(9F)

CIRCLEQ_LOOP_NEXT(9F)

CIRCLEQ_LOOP_PREV(9F)

CIRCLEQ_NEXT(9F)

CIRCLEQ_PREV(9F)

CIRCLEQ_REMOVE(9F)

clrbuf(9F)

cmn_err(9F)

condvar(9F)

copyb(9F)

copyin(9F)

copymsg(9F)

copyout(9F)

crgetgid(9F)

crgetgroups(9F)

crgetngroups(9F)

crgetrgid(9F)

crgetruid(9F)

crgetsgid(9F)

crgetsuid(9F)

crgetuid(9F)

crgetzoneid(9F)

csx_AccessConfigurationRegister(9F)

csx_ConvertSize(9F)

csx_ConvertSpeed(9F)

csx_CS_DDI_Info(9F)

csx_DeregisterClient(9F)

csx_DupHandle(9F)

csx_Error2Text(9F)

csx_Event2Text(9F)

csx_FreeHandle(9F)

csx_Get16(9F)

csx_Get32(9F)

csx_Get64(9F)

csx_Get8(9F)

csx_GetEventMask(9F)

csx_GetFirstClient(9F)

csx_GetFirstTuple(9F)

csx_GetHandleOffset(9F)

csx_GetMappedAddr(9F)

csx_GetNextClient(9F)

csx_GetNextTuple(9F)

csx_GetStatus(9F)

csx_GetTupleData(9F)

csx_MakeDeviceNode(9F)

csx_MapLogSocket(9F)

csx_MapMemPage(9F)

csx_ModifyConfiguration(9F)

csx_ModifyWindow(9F)

csx_Parse_CISTPL_BATTERY(9F)

csx_Parse_CISTPL_BYTEORDER(9F)

csx_Parse_CISTPL_CFTABLE_ENTRY(9F)

csx_Parse_CISTPL_CONFIG(9F)

csx_Parse_CISTPL_DATE(9F)

csx_Parse_CISTPL_DEVICE(9F)

csx_Parse_CISTPL_DEVICE_A(9F)

csx_Parse_CISTPL_DEVICEGEO(9F)

csx_Parse_CISTPL_DEVICEGEO_A(9F)

csx_Parse_CISTPL_DEVICE_OA(9F)

csx_Parse_CISTPL_DEVICE_OC(9F)

csx_Parse_CISTPL_FORMAT(9F)

csx_Parse_CISTPL_FUNCE(9F)

csx_Parse_CISTPL_FUNCID(9F)

csx_Parse_CISTPL_GEOMETRY(9F)

csx_Parse_CISTPL_JEDEC_A(9F)

csx_Parse_CISTPL_JEDEC_C(9F)

csx_Parse_CISTPL_LINKTARGET(9F)

csx_Parse_CISTPL_LONGLINK_A(9F)

csx_Parse_CISTPL_LONGLINK_C(9F)

csx_Parse_CISTPL_LONGLINK_MFC(9F)

csx_Parse_CISTPL_MANFID(9F)

csx_Parse_CISTPL_ORG(9F)

csx_Parse_CISTPL_SPCL(9F)

csx_Parse_CISTPL_SWIL(9F)

csx_Parse_CISTPL_VERS_1(9F)

csx_Parse_CISTPL_VERS_2(9F)

csx_ParseTuple(9F)

csx_Put16(9F)

csx_Put32(9F)

csx_Put64(9F)

csx_Put8(9F)

csx_RegisterClient(9F)

csx_ReleaseConfiguration(9F)

csx_ReleaseIO(9F)

csx_ReleaseIRQ(9F)

csx_ReleaseSocketMask(9F)

csx_ReleaseWindow(9F)

csx_RemoveDeviceNode(9F)

csx_RepGet16(9F)

csx_RepGet32(9F)

csx_RepGet64(9F)

csx_RepGet8(9F)

csx_RepPut16(9F)

csx_RepPut32(9F)

csx_RepPut64(9F)

csx_RepPut8(9F)

csx_RequestConfiguration(9F)

csx_RequestIO(9F)

csx_RequestIRQ(9F)

csx_RequestSocketMask(9F)

csx_RequestWindow(9F)

csx_ResetFunction(9F)

csx_SetEventMask(9F)

csx_SetHandleOffset(9F)

csx_ValidateCIS(9F)

cv_broadcast(9F)

cv_destroy(9F)

cv_init(9F)

cv_reltimedwait(9F)

cv_reltimedwait_sig(9F)

cv_signal(9F)

cv_timedwait(9F)

cv_timedwait_sig(9F)

cv_wait(9F)

cv_wait_sig(9F)

datamsg(9F)

DB_BASE(9F)

DB_LIM(9F)

DB_REF(9F)

DB_TYPE(9F)

ddi_add_event_handler(9F)

ddi_add_intr(9F)

ddi_add_softintr(9F)

ddi_binding_name(9F)

ddi_btop(9F)

ddi_btopr(9F)

ddi_can_receive_sig(9F)

ddi_cb_register(9F)

ddi_cb_unregister(9F)

ddi_check_acc_handle(9F)

ddi_check_dma_handle(9F)

ddi_copyin(9F)

ddi_copyout(9F)

ddi_create_minor_node(9F)

ddi_cred(9F)

ddi_device_copy(9F)

ddi_device_zero(9F)

ddi_devid_compare(9F)

ddi_devid_free(9F)

ddi_devid_get(9F)

ddi_devid_init(9F)

ddi_devid_register(9F)

ddi_devid_sizeof(9F)

ddi_devid_str_decode(9F)

ddi_devid_str_encode(9F)

ddi_devid_str_free(9F)

ddi_devid_unregister(9F)

ddi_devid_valid(9F)

ddi_dev_is_sid(9F)

ddi_devmap_segmap(9F)

ddi_dev_nintrs(9F)

ddi_dev_nregs(9F)

ddi_dev_regsize(9F)

ddi_dev_report_fault(9F)

ddi_dma_addr_bind_handle(9F)

ddi_dma_addr_setup(9F)

ddi_dma_alloc_handle(9F)

ddi_dma_buf_bind_handle(9F)

ddi_dma_buf_setup(9F)

ddi_dma_burstsizes(9F)

ddi_dma_coff(9F)

ddi_dma_curwin(9F)

ddi_dma_devalign(9F)

ddi_dmae_1stparty(9F)

ddi_dmae(9F)

ddi_dmae_alloc(9F)

ddi_dmae_disable(9F)

ddi_dmae_enable(9F)

ddi_dmae_getattr(9F)

ddi_dmae_getcnt(9F)

ddi_dmae_getlim(9F)

ddi_dmae_prog(9F)

ddi_dmae_release(9F)

ddi_dmae_stop(9F)

ddi_dma_free(9F)

ddi_dma_free_handle(9F)

ddi_dma_get_attr(9F)

ddi_dma_getwin(9F)

ddi_dma_htoc(9F)

ddi_dma_mem_alloc(9F)

ddi_dma_mem_free(9F)

ddi_dma_movwin(9F)

ddi_dma_nextcookie(9F)

ddi_dma_nextseg(9F)

ddi_dma_nextwin(9F)

ddi_dma_numwin(9F)

ddi_dma_segtocookie(9F)

ddi_dma_set_sbus64(9F)

ddi_dma_setup(9F)

ddi_dma_sync(9F)

ddi_dma_unbind_handle(9F)

ddi_driver_major(9F)

ddi_driver_name(9F)

ddi_enter_critical(9F)

ddi_exit_critical(9F)

ddi_ffs(9F)

ddi_fls(9F)

ddi_fm_acc_err_clear(9F)

ddi_fm_acc_err_get(9F)

ddi_fm_capable(9F)

ddi_fm_dma_err_clear(9F)

ddi_fm_dma_err_get(9F)

ddi_fm_ereport_post(9F)

ddi_fm_fini(9F)

ddi_fm_handler_register(9F)

ddi_fm_handler_unregister(9F)

ddi_fm_init(9F)

ddi_fm_service_impact(9F)

ddi_get16(9F)

ddi_get32(9F)

ddi_get64(9F)

ddi_get8(9F)

ddi_getb(9F)

ddi_get_cred(9F)

ddi_get_devstate(9F)

ddi_get_driver_private(9F)

ddi_get_eventcookie(9F)

ddi_get_iblock_cookie(9F)

ddi_getiminor(9F)

ddi_get_instance(9F)

ddi_get_kt_did(9F)

ddi_getl(9F)

ddi_get_lbolt64(9F)

ddi_get_lbolt(9F)

ddi_getll(9F)

ddi_getlongprop(9F)

ddi_getlongprop_buf(9F)

ddi_get_name(9F)

ddi_get_parent(9F)

ddi_get_pid(9F)

ddi_getprop(9F)

ddi_getproplen(9F)

ddi_get_soft_iblock_cookie(9F)

ddi_get_soft_state(9F)

ddi_get_time(9F)

ddi_getw(9F)

ddi_in_panic(9F)

ddi_intr_add_handler(9F)

ddi_intr_add_softint(9F)

ddi_intr_alloc(9F)

ddi_intr_block_disable(9F)

ddi_intr_block_enable(9F)

ddi_intr_clr_mask(9F)

ddi_intr_disable(9F)

ddi_intr_dup_handler(9F)

ddi_intr_enable(9F)

ddi_intr_free(9F)

ddi_intr_get_cap(9F)

ddi_intr_get_hilevel_pri(9F)

ddi_intr_get_navail(9F)

ddi_intr_get_nintrs(9F)

ddi_intr_get_pending(9F)

ddi_intr_get_pri(9F)

ddi_intr_get_softint_pri(9F)

ddi_intr_get_supported_types(9F)

ddi_intr_hilevel(9F)

ddi_intr_remove_handler(9F)

ddi_intr_remove_softint(9F)

ddi_intr_set_cap(9F)

ddi_intr_set_mask(9F)

ddi_intr_set_nreq(9F)

ddi_intr_set_pri(9F)

ddi_intr_set_softint_pri(9F)

ddi_intr_trigger_softint(9F)

ddi_io_get16(9F)

ddi_io_get32(9F)

ddi_io_get8(9F)

ddi_io_getb(9F)

ddi_io_getl(9F)

ddi_io_getw(9F)

ddi_iomin(9F)

ddi_iopb_alloc(9F)

ddi_iopb_free(9F)

ddi_io_put16(9F)

ddi_io_put32(9F)

ddi_io_put8(9F)

ddi_io_putb(9F)

ddi_io_putl(9F)

ddi_io_putw(9F)

ddi_io_rep_get16(9F)

ddi_io_rep_get32(9F)

ddi_io_rep_get8(9F)

ddi_io_rep_getb(9F)

ddi_io_rep_getl(9F)

ddi_io_rep_getw(9F)

ddi_io_rep_put16(9F)

ddi_io_rep_put32(9F)

ddi_io_rep_put8(9F)

ddi_io_rep_putb(9F)

ddi_io_rep_putl(9F)

ddi_io_rep_putw(9F)

ddi_log_sysevent(9F)

ddi_map_regs(9F)

ddi_mem_alloc(9F)

ddi_mem_free(9F)

ddi_mem_get16(9F)

ddi_mem_get32(9F)

ddi_mem_get64(9F)

ddi_mem_get8(9F)

ddi_mem_getb(9F)

ddi_mem_getl(9F)

ddi_mem_getll(9F)

ddi_mem_getw(9F)

ddi_mem_put16(9F)

ddi_mem_put32(9F)

ddi_mem_put64(9F)

ddi_mem_put8(9F)

ddi_mem_putb(9F)

ddi_mem_putl(9F)

ddi_mem_putll(9F)

ddi_mem_putw(9F)

ddi_mem_rep_get16(9F)

ddi_mem_rep_get32(9F)

ddi_mem_rep_get64(9F)

ddi_mem_rep_get8(9F)

ddi_mem_rep_getb(9F)

ddi_mem_rep_getl(9F)

ddi_mem_rep_getll(9F)

ddi_mem_rep_getw(9F)

ddi_mem_rep_put16(9F)

ddi_mem_rep_put32(9F)

ddi_mem_rep_put64(9F)

ddi_mem_rep_put8(9F)

ddi_mem_rep_putb(9F)

ddi_mem_rep_putl(9F)

ddi_mem_rep_putll(9F)

ddi_mem_rep_putw(9F)

ddi_mmap_get_model(9F)

ddi_modclose(9F)

ddi_model_convert_from(9F)

ddi_modopen(9F)

ddi_modsym(9F)

ddi_node_name(9F)

ddi_no_info(9F)

ddi_peek16(9F)

ddi_peek32(9F)

ddi_peek64(9F)

ddi_peek8(9F)

ddi_peek(9F)

ddi_peekc(9F)

ddi_peekd(9F)

ddi_peekl(9F)

ddi_peeks(9F)

ddi_periodic_add(9F)

ddi_periodic_delete(9F)

ddi_poke16(9F)

ddi_poke32(9F)

ddi_poke64(9F)

ddi_poke8(9F)

ddi_poke(9F)

ddi_pokec(9F)

ddi_poked(9F)

ddi_pokel(9F)

ddi_pokes(9F)

ddi_prop_create(9F)

ddi_prop_exists(9F)

ddi_prop_free(9F)

ddi_prop_get_int64(9F)

ddi_prop_get_int(9F)

ddi_prop_lookup(9F)

ddi_prop_lookup_byte_array(9F)

ddi_prop_lookup_int64_array(9F)

ddi_prop_lookup_int_array(9F)

ddi_prop_lookup_string(9F)

ddi_prop_lookup_string_array(9F)

ddi_prop_modify(9F)

ddi_prop_op(9F)

ddi_prop_remove(9F)

ddi_prop_remove_all(9F)

ddi_prop_undefine(9F)

ddi_prop_update(9F)

ddi_prop_update_byte_array(9F)

ddi_prop_update_int64(9F)

ddi_prop_update_int64_array(9F)

ddi_prop_update_int(9F)

ddi_prop_update_int_array(9F)

ddi_prop_update_string(9F)

ddi_prop_update_string_array(9F)

ddi_ptob(9F)

ddi_put16(9F)

ddi_put32(9F)

ddi_put64(9F)

ddi_put8(9F)

ddi_putb(9F)

ddi_putl(9F)

ddi_putll(9F)

ddi_putw(9F)

ddi_regs_map_free(9F)

ddi_regs_map_setup(9F)

ddi_remove_event_handler(9F)

ddi_remove_intr(9F)

ddi_remove_minor_node(9F)

ddi_remove_softintr(9F)

ddi_removing_power(9F)

ddi_rep_get16(9F)

ddi_rep_get32(9F)

ddi_rep_get64(9F)

ddi_rep_get8(9F)

ddi_rep_getb(9F)

ddi_rep_getl(9F)

ddi_rep_getll(9F)

ddi_rep_getw(9F)

ddi_report_dev(9F)

ddi_rep_put16(9F)

ddi_rep_put32(9F)

ddi_rep_put64(9F)

ddi_rep_put8(9F)

ddi_rep_putb(9F)

ddi_rep_putl(9F)

ddi_rep_putll(9F)

ddi_rep_putw(9F)

ddi_root_node(9F)

ddi_segmap(9F)

ddi_segmap_setup(9F)

ddi_set_driver_private(9F)

ddi_slaveonly(9F)

ddi_soft_state(9F)

ddi_soft_state_fini(9F)

ddi_soft_state_free(9F)

ddi_soft_state_init(9F)

ddi_soft_state_zalloc(9F)

ddi_strdup(9F)

ddi_strtol(9F)

ddi_strtoll(9F)

ddi_strtoul(9F)

ddi_strtoull(9F)

ddi_taskq_create(9F)

ddi_taskq_destroy(9F)

ddi_taskq_dispatch(9F)

ddi_taskq_resume(9F)

ddi_taskq_suspend(9F)

ddi_taskq_wait(9F)

ddi_trigger_softintr(9F)

ddi_umem_alloc(9F)

ddi_umem_free(9F)

ddi_umem_iosetup(9F)

ddi_umem_lock(9F)

ddi_umem_unlock(9F)

ddi_unmap_regs(9F)

delay(9F)

desballoc(9F)

devmap_default_access(9F)

devmap_devmem_setup(9F)

devmap_do_ctxmgt(9F)

devmap_load(9F)

devmap_set_ctx_timeout(9F)

devmap_setup(9F)

devmap_umem_setup(9F)

devmap_unload(9F)

disksort(9F)

dlbindack(9F)

dlerrorack(9F)

dlokack(9F)

dlphysaddrack(9F)

dluderrorind(9F)

drv_getparm(9F)

drv_hztousec(9F)

drv_priv(9F)

drv_usectohz(9F)

drv_usecwait(9F)

dupb(9F)

dupmsg(9F)

enableok(9F)

esballoc(9F)

esbbcall(9F)

flushband(9F)

flushq(9F)

freeb(9F)

freemsg(9F)

free_pktiopb(9F)

freerbuf(9F)

freezestr(9F)

geterror(9F)

gethrtime(9F)

getmajor(9F)

getminor(9F)

get_pktiopb(9F)

getq(9F)

getrbuf(9F)

gld(9F)

gld_intr(9F)

gld_mac_alloc(9F)

gld_mac_free(9F)

gld_recv(9F)

gld_register(9F)

gld_sched(9F)

gld_unregister(9F)

hat_getkpfnum(9F)

hook_alloc(9F)

hook_free(9F)

id32_alloc(9F)

id32_free(9F)

id32_lookup(9F)

inb(9F)

inl(9F)

insq(9F)

inw(9F)

IOC_CONVERT_FROM(9F)

kiconv(9F)

kiconv_close(9F)

kiconv_open(9F)

kiconvstr(9F)

kmem_alloc(9F)

kmem_cache_alloc(9F)

kmem_cache_create(9F)

kmem_cache_destroy(9F)

kmem_cache_free(9F)

kmem_cache_set_move(9F)

kmem_free(9F)

kmem_zalloc(9F)

kstat_create(9F)

kstat_delete(9F)

kstat_install(9F)

kstat_named_init(9F)

kstat_named_setstr(9F)

kstat_queue(9F)

kstat_runq_back_to_waitq(9F)

kstat_runq_enter(9F)

kstat_runq_exit(9F)

kstat_waitq_enter(9F)

kstat_waitq_exit(9F)

kstat_waitq_to_runq(9F)

ldi_add_event_handler(9F)

ldi_aread(9F)

ldi_awrite(9F)

ldi_close(9F)

ldi_devmap(9F)

ldi_dump(9F)

ldi_ev_finalize(9F)

ldi_ev_get_cookie(9F)

ldi_ev_get_type(9F)

ldi_ev_notify(9F)

ldi_ev_register_callbacks(9F)

ldi_ev_remove_callbacks(9F)

ldi_get_dev(9F)

ldi_get_devid(9F)

ldi_get_eventcookie(9F)

ldi_get_minor_name(9F)

ldi_getmsg(9F)

ldi_get_otyp(9F)

ldi_get_size(9F)

ldi_ident_from_dev(9F)

ldi_ident_from_dip(9F)

ldi_ident_from_stream(9F)

ldi_ident_release(9F)

ldi_ioctl(9F)

ldi_open_by_dev(9F)

ldi_open_by_devid(9F)

ldi_open_by_name(9F)

ldi_poll(9F)

ldi_prop_exists(9F)

ldi_prop_get_int64(9F)

ldi_prop_get_int(9F)

ldi_prop_lookup_byte_array(9F)

ldi_prop_lookup_int64_array(9F)

ldi_prop_lookup_int_array(9F)

ldi_prop_lookup_string(9F)

ldi_prop_lookup_string_array(9F)

ldi_putmsg(9F)

ldi_read(9F)

ldi_remove_event_handler(9F)

ldi_strategy(9F)

ldi_write(9F)

linkb(9F)

list_create(9F)

list_destroy(9F)

LIST_EMPTY(9F)

LIST_ENTRY(9F)

LIST_FIRST(9F)

LIST_FOREACH(9F)

LIST_HEAD(9F)

list_head(9F)

LIST_HEAD_INITIALIZER(9F)

LIST_INIT(9F)

LIST_INSERT_AFTER(9F)

list_insert_after(9F)

LIST_INSERT_BEFORE(9F)

list_insert_before(9F)

LIST_INSERT_HEAD(9F)

list_insert_head(9F)

list_insert_tail(9F)

list_is_empty(9F)

list_link_active(9F)

list_link_init(9F)

list_link_replace(9F)

list_move_tail(9F)

LIST_NEXT(9F)

list_next(9F)

list_prev(9F)

LIST_REMOVE(9F)

list_remove(9F)

list_remove_head(9F)

list_remove_tail(9F)

list_tail(9F)

mac(9F)

mac_alloc(9F)

mac_fini_ops(9F)

mac_free(9F)

mac_hcksum_get(9F)

mac_hcksum_set(9F)

mac_init_ops(9F)

mac_link_update(9F)

mac_lso_get(9F)

mac_prop_info_set_default_link_flowctrl(9F)

mac_prop_info_set_default_str(9F)

mac_prop_info_set_default_uint8(9F)

mac_prop_info_set_perm(9F)

mac_prop_info_set_range_uint32(9F)

mac_register(9F)

mac_rx(9F)

mac_tx_update(9F)

mac_unregister(9F)

makecom(9F)

makecom_g0(9F)

makecom_g0_s(9F)

makecom_g1(9F)

makecom_g5(9F)

makedevice(9F)

max(9F)

MBLKHEAD(9F)

MBLKIN(9F)

MBLKL(9F)

MBLKSIZE(9F)

MBLKTAIL(9F)

mcopyin(9F)

mcopymsg(9F)

mcopyout(9F)

membar_consumer(9F)

membar_enter(9F)

membar_exit(9F)

membar_ops(9F)

membar_producer(9F)

memchr(9F)

memcmp(9F)

memcpy(9F)

memmove(9F)

memset(9F)

merror(9F)

mexchange(9F)

min(9F)

minphys(9F)

mioc2ack(9F)

miocack(9F)

miocnak(9F)

miocpullup(9F)

mkiocb(9F)

mod_info(9F)

mod_install(9F)

mod_modname(9F)

mod_remove(9F)

msgdsize(9F)

msgpullup(9F)

msgsize(9F)

mt-streams(9F)

mutex(9F)

mutex_destroy(9F)

mutex_enter(9F)

mutex_exit(9F)

mutex_init(9F)

mutex_owned(9F)

mutex_tryenter(9F)

net_event_notify_register(9F)

net_event_notify_unregister(9F)

net_getifname(9F)

net_getlifaddr(9F)

net_getmtu(9F)

net_getnetid(9F)

net_getpmtuenabled(9F)

net_hook_register(9F)

net_hook_unregister(9F)

netinfo(9F)

net_inject(9F)

net_inject_alloc(9F)

net_inject_free(9F)

net_instance_alloc(9F)

net_instance_free(9F)

net_instance_notify_register(9F)

net_instance_notify_unregister(9F)

net_instance_protocol_unregister(9F)

net_instance_register(9F)

net_instance_unregister(9F)

net_ispartialchecksum(9F)

net_isvalidchecksum(9F)

net_kstat_create(9F)

net_kstat_delete(9F)

net_lifgetnext(9F)

net_netidtozonid(9F)

net_phygetnext(9F)

net_phylookup(9F)

net_protocol_lookup(9F)

net_protocol_notify_register(9F)

net_protocol_release(9F)

net_protocol_walk(9F)

net_routeto(9F)

net_zoneidtonetid(9F)

nochpoll(9F)

nodev(9F)

noenable(9F)

nulldev(9F)

numtos(9F)

nv_alloc_fini(9F)

nv_alloc_init(9F)

nvlist_add_boolean(9F)

nvlist_add_boolean_array(9F)

nvlist_add_boolean_value(9F)

nvlist_add_byte(9F)

nvlist_add_byte_array(9F)

nvlist_add_int16(9F)

nvlist_add_int16_array(9F)

nvlist_add_int32(9F)

nvlist_add_int32_array(9F)

nvlist_add_int64(9F)

nvlist_add_int64_array(9F)

nvlist_add_int8(9F)

nvlist_add_int8_array(9F)

nvlist_add_nvlist(9F)

nvlist_add_nvlist_array(9F)

nvlist_add_nvpair(9F)

nvlist_add_string(9F)

nvlist_add_string_array(9F)

nvlist_add_uint16(9F)

nvlist_add_uint16_array(9F)

nvlist_add_uint32(9F)

nvlist_add_uint32_array(9F)

nvlist_add_uint64(9F)

nvlist_add_uint64_array(9F)

nvlist_add_uint8(9F)

nvlist_add_uint8_array(9F)

nvlist_alloc(9F)

nvlist_dup(9F)

nvlist_exists(9F)

nvlist_free(9F)

nvlist_lookup_boolean(9F)

nvlist_lookup_boolean_array(9F)

nvlist_lookup_boolean_value(9F)

nvlist_lookup_byte(9F)

nvlist_lookup_byte_array(9F)

nvlist_lookup_int16(9F)

nvlist_lookup_int16_array(9F)

nvlist_lookup_int32(9F)

nvlist_lookup_int32_array(9F)

nvlist_lookup_int64(9F)

nvlist_lookup_int64_array(9F)

nvlist_lookup_int8(9F)

nvlist_lookup_int8_array(9F)

nvlist_lookup_nvlist(9F)

nvlist_lookup_nvlist_array(9F)

nvlist_lookup_nvpair(9F)

nvlist_lookup_pairs(9F)

nvlist_lookup_string(9F)

nvlist_lookup_string_array(9F)

nvlist_lookup_uint16(9F)

nvlist_lookup_uint16_array(9F)

nvlist_lookup_uint32(9F)

nvlist_lookup_uint32_array(9F)

nvlist_lookup_uint64(9F)

nvlist_lookup_uint64_array(9F)

nvlist_lookup_uint8(9F)

nvlist_lookup_uint8_array(9F)

nvlist_merge(9F)

nvlist_next_nvpair(9F)

nvlist_pack(9F)

nvlist_remove(9F)

nvlist_remove_all(9F)

nvlist_size(9F)

nvlist_t(9F)

nvlist_unpack(9F)

nvlist_xalloc(9F)

nvlist_xdup(9F)

nvlist_xpack(9F)

nvlist_xunpack(9F)

nvpair_name(9F)

nvpair_type(9F)

nvpair_value_boolean_array(9F)

nvpair_value_byte(9F)

nvpair_value_byte_array(9F)

nvpair_value_int16(9F)

nvpair_value_int16_array(9F)

nvpair_value_int32(9F)

nvpair_value_int32_array(9F)

nvpair_value_int64(9F)

nvpair_value_int64_array(9F)

nvpair_value_int8(9F)

nvpair_value_int8_array(9F)

nvpair_value_nvlist(9F)

nvpair_value_nvlist_array(9F)

nvpair_value_string(9F)

nvpair_value_string_array(9F)

nvpair_value_uint16(9F)

nvpair_value_uint16_array(9F)

nvpair_value_uint32(9F)

nvpair_value_uint32_array(9F)

nvpair_value_uint64(9F)

nvpair_value_uint64_array(9F)

nvpair_value_uint8(9F)

nvpair_value_uint8_array(9F)

OTHERQ(9F)

otherq(9F)

outb(9F)

outl(9F)

outw(9F)

packet_events(9F)

pci_config_get16(9F)

pci_config_get32(9F)

pci_config_get64(9F)

pci_config_get8(9F)

pci_config_getb(9F)

pci_config_getl(9F)

pci_config_getll(9F)

pci_config_getw(9F)

pci_config_put16(9F)

pci_config_put32(9F)

pci_config_put64(9F)

pci_config_put8(9F)

pci_config_putb(9F)

pci_config_putl(9F)

pci_config_putll(9F)

pci_config_putw(9F)

pci_config_setup(9F)

pci_config_teardown(9F)

pci_ereport_post(9F)

pci_ereport_setup(9F)

pci_ereport_teardown(9F)

pci_param_free(9F)

pci_param_get(9F)

pci_param_get_ioctl(9F)

pci_plist_get(9F)

pci_plist_getvf(9F)

pci_plist_lookup(9F)

pci_plist_lookup_int16(9F)

pci_plist_lookup_int16_array(9F)

pci_plist_lookup_int32(9F)

pci_plist_lookup_int32_array(9F)

pci_plist_lookup_int64(9F)

pci_plist_lookup_int64_array(9F)

pci_plist_lookup_int8(9F)

pci_plist_lookup_int8_array(9F)

pci_plist_lookup_plist(9F)

pci_plist_lookup_string(9F)

pci_plist_lookup_string_array(9F)

pci_plist_lookup_uint16(9F)

pci_plist_lookup_uint16_array(9F)

pci_plist_lookup_uint32(9F)

pci_plist_lookup_uint32_array(9F)

pci_plist_lookup_uint64(9F)

pci_plist_lookup_uint64_array(9F)

pci_plist_lookup_uint8(9F)

pci_plist_lookup_uint8_array(9F)

pci_report_pmcap(9F)

pci_restore_config_regs(9F)

pci_save_config_regs(9F)

pciv_send(9F)

pciv_vf_config(9F)

physio(9F)

pm_busy_component(9F)

pm_idle_component(9F)

pm_lower_power(9F)

pm_power_has_changed(9F)

pm_raise_power(9F)

pm_trans_check(9F)

pollwakeup(9F)

priv_getbyname(9F)

priv_policy(9F)

priv_policy_choice(9F)

priv_policy_only(9F)

proc_ref(9F)

proc_signal(9F)

proc_unref(9F)

ptob(9F)

pullupmsg(9F)

put(9F)

putbq(9F)

putctl1(9F)

putctl(9F)

putnext(9F)

putnextctl1(9F)

putnextctl(9F)

putq(9F)

qassociate(9F)

qbufcall(9F)

qenable(9F)

qprocsoff(9F)

qprocson(9F)

qreply(9F)

qsize(9F)

qtimeout(9F)

queue(9F)

qunbufcall(9F)

quntimeout(9F)

qwait(9F)

qwait_sig(9F)

qwriter(9F)

RD(9F)

rd(9F)

repinsb(9F)

repinsd(9F)

repinsw(9F)

repoutsb(9F)

repoutsd(9F)

repoutsw(9F)

rmalloc(9F)

rmallocmap(9F)

rmallocmap_wait(9F)

rmalloc_wait(9F)

rmfree(9F)

rmfreemap(9F)

rmvb(9F)

rmvq(9F)

rw_destroy(9F)

rw_downgrade(9F)

rw_enter(9F)

rw_exit(9F)

rw_init(9F)

rwlock(9F)

rw_read_locked(9F)

rw_tryenter(9F)

rw_tryupgrade(9F)

SAMESTR(9F)

samestr(9F)

scsi_abort(9F)

scsi_alloc_consistent_buf(9F)

scsi_cname(9F)

scsi_destroy_pkt(9F)

scsi_dmafree(9F)

scsi_dmaget(9F)

scsi_dname(9F)

scsi_errmsg(9F)

scsi_ext_sense_fields(9F)

scsi_find_sense_descr(9F)

scsi_free_consistent_buf(9F)

scsi_get_device_type_scsi_options(9F)

scsi_get_device_type_string(9F)

scsi_hba_attach(9F)

scsi_hba_attach_setup(9F)

scsi_hba_detach(9F)

scsi_hba_fini(9F)

scsi_hba_init(9F)

scsi_hba_lookup_capstr(9F)

scsi_hba_pkt_alloc(9F)

scsi_hba_pkt_comp(9F)

scsi_hba_pkt_free(9F)

scsi_hba_probe(9F)

scsi_hba_tran_alloc(9F)

scsi_hba_tran_free(9F)

scsi_ifgetcap(9F)

scsi_ifsetcap(9F)

scsi_init_pkt(9F)

scsi_log(9F)

scsi_mname(9F)

scsi_pktalloc(9F)

scsi_pktfree(9F)

scsi_poll(9F)

scsi_probe(9F)

scsi_resalloc(9F)

scsi_reset(9F)

scsi_reset_notify(9F)

scsi_resfree(9F)

scsi_rname(9F)

scsi_sense_asc(9F)

scsi_sense_ascq(9F)

scsi_sense_cmdspecific_uint64(9F)

scsi_sense_info_uint64(9F)

scsi_sense_key(9F)

scsi_setup_cdb(9F)

scsi_slave(9F)

scsi_sname(9F)

scsi_sync_pkt(9F)

scsi_transport(9F)

scsi_unprobe(9F)

scsi_unslave(9F)

scsi_validate_sense(9F)

scsi_vu_errmsg(9F)

sema_destroy(9F)

sema_init(9F)

sema_p(9F)

semaphore(9F)

sema_p_sig(9F)

sema_tryp(9F)

sema_v(9F)

SIMPLEQ_EMPTY(9F)

SIMPLEQ_ENTRY(9F)

SIMPLEQ_FIRST(9F)

SIMPLEQ_FOREACH(9F)

SIMPLEQ_HEAD(9F)

SIMPLEQ_HEAD_INITIALIZER(9F)

SIMPLEQ_INIT(9F)

SIMPLEQ_INSERT_AFTER(9F)

SIMPLEQ_INSERT_HEAD(9F)

SIMPLEQ_INSERT_TAIL(9F)

SIMPLEQ_NEXT(9F)

SIMPLEQ_REMOVE(9F)

SIMPLEQ_REMOVE_HEAD(9F)

SIZEOF_PTR(9F)

SIZEOF_STRUCT(9F)

SLIST_EMPTY(9F)

SLIST_ENTRY(9F)

SLIST_FIRST(9F)

SLIST_FOREACH(9F)

SLIST_HEAD(9F)

SLIST_HEAD_INITIALIZER(9F)

SLIST_INIT(9F)

SLIST_INSERT_AFTER(9F)

SLIST_INSERT_HEAD(9F)

SLIST_NEXT(9F)

SLIST_REMOVE(9F)

SLIST_REMOVE_HEAD(9F)

snprintf(9F)

sprintf(9F)

STAILQ_CONCAT(9F)

STAILQ_EMPTY(9F)

STAILQ_ENTRY(9F)

STAILQ_FIRST(9F)

STAILQ_FOREACH(9F)

STAILQ_HEAD(9F)

STAILQ_HEAD_INITIALIZER(9F)

STAILQ_INIT(9F)

STAILQ_INSERT_AFTER(9F)

STAILQ_INSERT_HEAD(9F)

STAILQ_INSERT_TAIL(9F)

STAILQ_NEXT(9F)

STAILQ_REMOVE(9F)

STAILQ_REMOVE_HEAD(9F)

stoi(9F)

strcasecmp(9F)

strcasestr(9F)

strchr(9F)

strcmp(9F)

strcpy(9F)

strdup(9F)

strfree(9F)

string(9F)

strlcat(9F)

strlcpy(9F)

strlen(9F)

strlog(9F)

strncasecmp(9F)

strncat(9F)

strncmp(9F)

strncpy(9F)

strnlen(9F)

strqget(9F)

strqset(9F)

strrchr(9F)

strspn(9F)

strstr(9F)

STRUCT_BUF(9F)

STRUCT_DECL(9F)

STRUCT_FADDR(9F)

STRUCT_FGET(9F)

STRUCT_FGETP(9F)

STRUCT_FSET(9F)

STRUCT_FSETP(9F)

STRUCT_HANDLE(9F)

STRUCT_INIT(9F)

STRUCT_SET_HANDLE(9F)

STRUCT_SIZE(9F)

swab(9F)

TAILQ_CONCAT(9F)

TAILQ_EMPTY(9F)

TAILQ_ENTRY(9F)

TAILQ_FIRST(9F)

TAILQ_FOREACH(9F)

TAILQ_FOREACH_REVERSE(9F)

TAILQ_HEAD(9F)

TAILQ_HEAD_INITIALIZER(9F)

TAILQ_INIT(9F)

TAILQ_INSERT_AFTER(9F)

TAILQ_INSERT_BEFORE(9F)

TAILQ_INSERT_HEAD(9F)

TAILQ_INSERT_TAIL(9F)

TAILQ_LAST(9F)

TAILQ_NEXT(9F)

TAILQ_PREV(9F)

TAILQ_REMOVE(9F)

taskq(9F)

taskq_suspended(9F)

testb(9F)

timeout(9F)

u8_strcmp(9F)

u8_textprep_str(9F)

u8_validate(9F)

uconv_u16tou32(9F)

uconv_u16tou8(9F)

uconv_u32tou16(9F)

uconv_u32tou8(9F)

uconv_u8tou16(9F)

uconv_u8tou32(9F)

uiomove(9F)

unbufcall(9F)

unfreezestr(9F)

unlinkb(9F)

untimeout(9F)

ureadc(9F)

usb_alloc_bulk_req(9F)

usb_alloc_ctrl_req(9F)

usb_alloc_intr_req(9F)

usb_alloc_isoc_req(9F)

usb_alloc_request(9F)

usb_client_attach(9F)

usb_client_detach(9F)

usb_clr_feature(9F)

usb_create_pm_components(9F)

usb_free_bulk_req(9F)

usb_free_ctrl_req(9F)

usb_free_descr_tree(9F)

usb_free_dev_data(9F)

usb_free_intr_req(9F)

usb_free_isoc_req(9F)

usb_get_addr(9F)

usb_get_alt_if(9F)

usb_get_cfg(9F)

usb_get_current_frame_number(9F)

usb_get_dev_data(9F)

usb_get_if_number(9F)

usb_get_max_pkts_per_isoc_request(9F)

usb_get_status(9F)

usb_get_string_descr(9F)

usb_handle_remote_wakeup(9F)

usb_lookup_ep_data(9F)

usb_owns_device(9F)

usb_parse_data(9F)

usb_pipe_bulk_xfer(9F)

usb_pipe_close(9F)

usb_pipe_ctrl_xfer(9F)

usb_pipe_ctrl_xfer_wait(9F)

usb_pipe_drain_reqs(9F)

usb_pipe_get_max_bulk_transfer_size(9F)

usb_pipe_get_private(9F)

usb_pipe_get_state(9F)

usb_pipe_intr_xfer(9F)

usb_pipe_isoc_xfer(9F)

usb_pipe_open(9F)

usb_pipe_reset(9F)

usb_pipe_set_private(9F)

usb_pipe_stop_intr_polling(9F)

usb_pipe_stop_isoc_polling(9F)

usb_print_descr_tree(9F)

usb_register_hotplug_cbs(9F)

usb_reset_device(9F)

usb_set_alt_if(9F)

usb_set_cfg(9F)

usb_unregister_hotplug_cbs(9F)

uwritec(9F)

va_arg(9F)

va_copy(9F)

va_end(9F)

va_start(9F)

vcmn_err(9F)

vsprintf(9F)

WR(9F)

wr(9F)

zcmn_err(9F)

queue

, SLIST_HEAD

, SLIST_HEAD_INITIALIZER

, SLIST_ENTRY

, SLIST_INIT

, SLIST_INSERT_AFTER

, SLIST_INSERT_HEAD

, SLIST_REMOVE_HEAD

, SLIST_REMOVE

, SLIST_FOREACH

, SLIST_EMPTY

, SLIST_FIRST

, SLIST_NEXT

, SIMPLEQ_HEAD

, SIMPLEQ_HEAD_INITIALIZER

, SIMPLEQ_ENTRY

, SIMPLEQ_INIT

, SIMPLEQ_INSERT_HEAD

, SIMPLEQ_INSERT_TAIL

, SIMPLEQ_INSERT_AFTER

, SIMPLEQ_REMOVE_HEAD

, SIMPLEQ_REMOVE

, SIMPLEQ_FOREACH

, SIMPLEQ_EMPTY

, SIMPLEQ_FIRST

, SIMPLEQ_NEXT

, STAILQ_HEAD

, STAILQ_HEAD_INITIALIZER

, STAILQ_ENTRY

, STAILQ_INIT

, STAILQ_INSERT_HEAD

, STAILQ_INSERT_TAIL

, STAILQ_INSERT_AFTER

, STAILQ_REMOVE_HEAD

, STAILQ_REMOVE

, STAILQ_FOREACH

, STAILQ_EMPTY

, STAILQ_FIRST

, STAILQ_NEXT

, STAILQ_CONCAT

, LIST_HEAD

, LIST_HEAD_INITIALIZER

, LIST_ENTRY

, LIST_INIT

, LIST_INSERT_AFTER

, LIST_INSERT_BEFORE

, LIST_INSERT_HEAD

, LIST_REMOVE

, LIST_FOREACH

, LIST_EMPTY

, LIST_FIRST

, LIST_NEXT

, TAILQ_HEAD

, TAILQ_HEAD_INITIALIZER

, TAILQ_ENTRY

, TAILQ_INIT

, TAILQ_INSERT_HEAD

, TAILQ_INSERT_TAIL

, TAILQ_INSERT_AFTER

, TAILQ_INSERT_BEFORE

, TAILQ_REMOVE

, TAILQ_FOREACH

, TAILQ_FOREACH_REVERSE

, TAILQ_EMPTY

, TAILQ_FIRST

, TAILQ_NEXT

, TAILQ_LAST

, TAILQ_PREV

, TAILQ_CONCAT

, CIRCLEQ_HEAD

, CIRCLEQ_HEAD_INITIALIZER

, CIRCLEQ_ENTRY

, CIRCLEQ_INIT

, CIRCLEQ_INSERT_AFTER

, CIRCLEQ_INSERT_BEFORE

, CIRCLEQ_INSERT_HEAD

, CIRCLEQ_INSERT_TAIL

, CIRCLEQ_REMOVE

, CIRCLEQ_FOREACH

, CIRCLEQ_FOREACH_REVERSE

, CIRCLEQ_EMPTY

, CIRCLEQ_FIRST

, CIRCLEQ_LAST

, CIRCLEQ_NEXT

, CIRCLEQ_PREV

, CIRCLEQ_LOOP_NEXT

, CIRCLEQ_LOOP_PREV

- implementations of singly-linked lists, simple queues, lists, tail queues, and circular queues

Synopsis

#include <sys/queue.h>

SLIST_HEAD(HEADNAME, TYPE);
SLIST_HEAD_INITIALIZER(head);
SLIST_ENTRY(TYPE);
SLIST_INIT(SLIST_HEAD *head)
SLIST_INSERT_AFTER(TYPE *listelm, TYPE *elm, SLIST_ENTRY NAME);
SLIST_INSERT_HEAD(SLIST_HEAD *head, TYPE *elm, SLIST_ENTRY NAME)
SLIST_REMOVE_HEAD(SLIST_HEAD *head, SLIST_ENTRY NAME);
SLIST_REMOVE(SLIST_HEAD *head, TYPE *elm, TYPE, SLIST_ENTRY NAME);
SLIST_FOREACH(TYPE *var, SLIST_HEAD *head, SLIST_ENTRY NAME);
int SLIST_EMPTY(SLIST_HEAD *head);
TYPE *SLIST_FIRST(SLIST_HEAD *head);
TYPE *SLIST_NEXT(TYPE *elm, SLIST_ENTRY NAME);
SIMPLEQ_HEAD(HEADNAME, TYPE);
SIMPLEQ_HEAD_INITIALIZER(head);
SIMPLEQ_ENTRY(TYPE);
SIMPLEQ_INIT(SIMPLEQ_HEAD *head);
SIMPLEQ_INSERT_HEAD(SIMPLEQ_HEAD *head, TYPE *elm, SIMPLEQ_ENTRY NAME);
SIMPLEQ_INSERT_TAIL(SIMPLEQ_HEAD *head, TYPE *elm, SIMPLEQ_ENTRY NAME);
SIMPLEQ_INSERT_AFTER(SIMPLEQ_HEAD *head, TYPE *listelm, TYPE *elm,
     SIMPLEQ_ENTRY NAME);
SIMPLEQ_REMOVE_HEAD(SIMPLEQ_HEAD *head, SIMPLEQ_ENTRY NAME);
SIMPLEQ_REMOVE(SIMPLEQ_HEAD *head, TYPE *elm, TYPE, SIMPLEQ_ENTRY NAME);
SIMPLEQ_FOREACH(TYPE *var, SIMPLEQ_HEAD *head, SIMPLEQ_ENTRY NAME);
int SIMPLEQ_EMPTY(SIMPLEQ_HEAD *head)
TYPE *SIMPLEQ_FIRST(SIMPLEQ_HEAD *head);
TYPE *SIMPLEQ_NEXT(TYPE *elm, SIMPLEQ_ENTRY NAME);
STAILQ_HEAD(HEADNAME, TYPE);
STAILQ_HEAD_INITIALIZER(head);
STAILQ_ENTRY(TYPE);
STAILQ_INIT(STAILQ_HEAD *head);
STAILQ_INSERT_HEAD(STAILQ_HEAD *head, TYPE *elm, STAILQ_ENTRY NAME);
STAILQ_INSERT_TAIL(STAILQ_HEAD *head, TYPE *elm, STAILQ_ENTRY NAME);
STAILQ_INSERT_AFTER(STAILQ_HEAD *head, TYPE *listelm, TYPE *elm,
     STAILQ_ENTRY NAME);
STAILQ_REMOVE_HEAD(STAILQ_HEAD *head, STAILQ_ENTRY NAME);
STAILQ_REMOVE(STAILQ_HEAD *head, TYPE *elm, TYPE, STAILQ_ENTRY NAME);
STAILQ_FOREACH(TYPE *var, STAILQ_HEAD *head, STAILQ_ENTRY NAME);
int STAILQ_EMPTY(STAILQ_HEAD *head);
TYPE *STAILQ_FIRST(STAILQ_HEAD *head);
TYPE *STAILQ_NEXT(TYPE *elm, STAILQ_ENTRY NAME);
STAILQ_CONCAT(STAILQ_HEAD *head1, STAILQ_HEAD *head2);
LIST_HEAD(HEADNAME, TYPE);
LIST_HEAD_INITIALIZER(head);
LIST_ENTRY(TYPE);
LIST_INIT(LIST_HEAD *head);
LIST_INSERT_AFTER(TYPE *listelm, TYPE *elm, LIST_ENTRY NAME);
LIST_INSERT_BEFORE(TYPE *listelm, TYPE *elm, LIST_ENTRY NAME);
LIST_INSERT_HEAD(LIST_HEAD *head, TYPE *elm, LIST_ENTRY NAME);
LIST_REMOVE(TYPE *elm, LIST_ENTRY NAME);
LIST_FOREACH(TYPE *var, LIST_HEAD *head, LIST_ENTRY NAME);
int LIST_EMPTY(LIST_HEAD *head);
TYPE *LIST_FIRST(LIST_HEAD *head);
TYPE *LIST_NEXT(TYPE *elm, LIST_ENTRY NAME);
TAILQ_HEAD(HEADNAME, TYPE);
TAILQ_HEAD_INITIALIZER(head);
TAILQ_ENTRY(TYPE);
TAILQ_INIT(TAILQ_HEAD *head);
TAILQ_INSERT_HEAD(TAILQ_HEAD *head, TYPE *elm, TAILQ_ENTRY NAME);
TAILQ_INSERT_TAIL(TAILQ_HEAD *head, TYPE *elm, TAILQ_ENTRY NAME)
TAILQ_INSERT_AFTER(TAILQ_HEAD *head, TYPE *listelm, TYPE *elm,
     TAILQ_ENTRY NAME);
TAILQ_INSERT_BEFORE(TYPE *listelm, TYPE *elm, TAILQ_ENTRY NAME);
TAILQ_REMOVE(TAILQ_HEAD *head, TYPE *elm, TAILQ_ENTRY NAME);
TAILQ_FOREACH(TYPE *var, TAILQ_HEAD *head, TAILQ_ENTRY NAME);
TAILQ_FOREACH_REVERSE(TYPE *var, TAILQ_HEAD *head, HEADNAME,
     TAILQ_ENTRY NAME);
int TAILQ_EMPTY(TAILQ_HEAD *head);
TYPE *TAILQ_FIRST(TAILQ_HEAD *head);
TYPE *TAILQ_NEXT(TYPE *elm, TAILQ_ENTRY NAME);
TYPE *TAILQ_LAST(TAILQ_HEAD *head, HEADNAME);
TYPE *TAILQ_PREV(TYPE *elm, HEADNAME, TAILQ_ENTRY NAME);
TAILQ_CONCAT(TAILQ_HEAD *head1, TAILQ_HEAD *head2, TAILQ_ENTRY NAME);
CIRCLEQ_HEAD(HEADNAME, TYPE);
CIRCLEQ_HEAD_INITIALIZER(head);
CIRCLEQ_ENTRY(TYPE);
CIRCLEQ_INIT(CIRCLEQ_HEAD *head);
CIRCLEQ_INSERT_AFTER(CIRCLEQ_HEAD *head, TYPE *listelm, TYPE *elm,
     CIRCLEQ_ENTRY NAME);
CIRCLEQ_INSERT_BEFORE(CIRCLEQ_HEAD *head, TYPE *listelm, TYPE *elm,
     CIRCLEQ_ENTRY NAME);
CIRCLEQ_INSERT_HEAD(CIRCLEQ_HEAD *head, TYPE *elm, CIRCLEQ_ENTRY NAME);
CIRCLEQ_INSERT_TAIL(CIRCLEQ_HEAD *head, TYPE *elm, CIRCLEQ_ENTRY NAME);
CIRCLEQ_REMOVE(CIRCLEQ_HEAD *head, TYPE *elm, CIRCLEQ_ENTRY NAME);
CIRCLEQ_FOREACH(TYPE *var, CIRCLEQ_HEAD *head, CIRCLEQ_ENTRY NAME);
CIRCLEQ_FOREACH_REVERSE(TYPE *var, CIRCLEQ_HEAD *head,
     CIRCLEQ_ENTRY NAME);
int CIRCLEQ_EMPTY(CIRCLEQ_HEAD *head);
TYPE *CIRCLEQ_FIRST(CIRCLEQ_HEAD *head);
TYPE *CIRCLEQ_LAST(CIRCLEQ_HEAD *head);
TYPE *CIRCLEQ_NEXT(TYPE *elm, CIRCLEQ_ENTRY NAME);
TYPE *CIRCLEQ_PREV(TYPE *elm, CIRCLEQ_ENTRY NAME);
TYPE *CIRCLEQ_LOOP_NEXT(CIRCLEQ_HEAD *head, TYPE *elm, CIRCLEQ_ENTRY NAME);
TYPE *CIRCLEQ_LOOP_PREV(CIRCLEQ_HEAD *head, TYPE *elm, CIRCLEQ_ENTRY NAME);

Interface Level

Architecture independent level 11 (DDI/DKI).

Description

These macros define and operate on five types of data structures: singly- linked lists, simple queues, lists, tail queues, and circular queues. All five structures support the following functionality:

  1. Insertion of a new entry at the head of the list.

  2. Insertion of a new entry before or after any element in the list.

  3. Removal of any entry in the list.

  4. Forward traversal through the list.

Singly-linked lists are the simplest of the five data structures and support only the above functionality. Singly-linked lists are ideal for applications with large datasets and few or no removals, or for implementing a LIFO queue.

  1. Entries can be added at the end of a list.

  2. They may be concatenated.

However:

  1. Entries may not be added before any element in the list.

  2. All list insertions and removals must specify the head of the list.

  3. Each head entry requires two pointers rather than one.

Simple queues are ideal for applications with large datasets and few or no removals, or for implementing a FIFO queue.

All doubly linked types of data structures (lists, tail queues, and circle queues) additionally allow:

  1. Insertion of a new entry before any element in the list.

  2. O(1) removal of any entry in the list.

However:

  1. Each element requires two pointers rather than one.

  2. Code size and execution time of operations (except for removal) is about twice that of the singly-linked data structures

Linked lists are the simplest of the doubly linked data structures and support only the above functionality over singly-linked lists.

Tail queues add the following functionality:

  1. Entries can be added at the end of a list.

  2. They may be concatenated.

However:

  1. All list insertions and removals, except insertion before another element, must specify the head of the list.

  2. Each head entry requires two pointers rather than one.

  3. Code size is about 15% greater and operations run about 20% slower than lists.

Circular queues add the following functionality:

  1. Entries can be added at the end of a list.

  2. They may be traversed backwards, from tail to head.

However:

  1. All list insertions and removals must specify the head of the list.

  2. Each head entry requires two pointers rather than one.

  3. The termination condition for traversal is more complex.

  4. Code size is about 40% greater and operations run about 45% slower than lists.

In the macro definitions, TYPE is the name of a user defined structure, that must contain a field of type LIST_ENTRY, SIMPLEQ_ENTRY, SLIST_ENTRY, TAILQ_ENTRY, or CIRCLEQ_ENTRY, named NAME. The argument HEADNAME is the name of a user defined structure that must be declared using the macros LIST_HEAD(), SIMPLEQ_HEAD(), SLIST_HEAD(), TAILQ_HEAD(), or CIRCLEQ_HEAD(). See the examples below for further explanation of how these macros are used.

Summary of Operations

The following table summarizes the supported macros for each type of data structure.

+-----------------+-------+------+---------+--------+-------+---------+
|                 | SLIST | LIST | SIMPLEQ | STAILQ | TAILQ | CIRCLEQ |
+-----------------+-------+------+---------+--------+-------+---------+
|_EMPTY           |   +   |  +   |    +    |   +    |   +   |    +    |
|_FIRST           |   +   |  +   |    +    |   +    |   +   |    +    |
|_FOREACH         |   +   |  +   |    +    |   +    |   +   |    +    |
|_FOREACH_REVERSE |   -   |  -   |    -    |   -    |   +   |    +    |
|_INSERT_AFTER    |   +   |  +   |    +    |   +    |   +   |    +    |
|_INSERT_BEFORE   |   -   |  +   |    -    |   -    |   +   |    +    |
|_INSERT_HEAD     |   +   |  +   |    +    |   +    |   +   |    +    |
|_INSERT_TAIL     |   -   |  -   |    +    |   +    |   +   |    +    |
|_LAST            |   -   |  -   |    -    |   -    |   +   |    +    |
|_LOOP_NEXT       |   -   |  -   |    -    |   -    |   -   |    +    |
|_LOOP_PREV       |   -   |  -   |    -    |   -    |   -   |    +    |
|_NEXT            |   +   |  +   |    +    |   +    |   +   |    +    |
|_PREV            |   -   |  -   |    -    |   -    |   +   |    +    |
|_REMOVE          |   +   |  +   |    +    |   +    |   +   |    +    |
|_REMOVE_HEAD     |   +   |  -   |    +    |   +    |   -   |    -    |
|_CONCAT          |   -   |  -   |    -    |   +    |   +   |    -    |
+-----------------+-------+------+---------+--------+-------+---------+

Singly-linked Lists

A singly-linked list is headed by a structure defined by the SLIST_HEAD() macro. This structure contains a single pointer to the first element on the list. The elements are singly linked for minimum space and pointer manipulation overhead at the expense of O(n) removal for arbitrary elements. New elements can be added to the list after an existing element or at the head of the list. An SLIST_HEAD structure is declared as follows:

SLIST_HEAD(HEADNAME, TYPE) head;

where HEADNAME is the name of the structure to be defined, and TYPE is the type of the elements to be linked into the list. A pointer to the head of the list can later be declared as:

struct HEADNAME *headp;

The names head and headp are user selectable.

The macro SLIST_HEAD_INITIALIZER() evaluates to an initializer for the list head

The macro SLIST_EMPTY() evaluates to true if there are no elements in the list.

The macro SLIST_ENTRY() declares a structure that connects the elements in the list.

The macro SLIST_FIRST() returns the first element in the list or NULL if the list is empty.

The macro SLIST_FOREACH() traverses the list referenced by head in the forward direction, assigning each element in turn to var.

The macro SLIST_INIT() initializes the list referenced by head.

The macro SLIST_INSERT_HEAD() inserts the new element elm at the head of the list.

The macro SLIST_INSERT_AFTER() inserts the new element elm after the element listelm.

The macro SLIST_NEXT() returns the next element in the list.

The macro SLIST_REMOVE() removes the element elm from the list.

The macro SLIST_REMOVE_HEAD() removes the first element from the head of the list. For optimum efficiency, elements being removed from the head of the list should explicitly use this macro instead of the generic SLIST_REMOVE() macro.

Singly-linked List Example

SLIST_HEAD(slisthead, entry) head =
    SLIST_HEAD_INITIALIZER(head);
struct slisthead *headp;                /* Singly-linked List head. */
struct entry {
        ...
        SLIST_ENTRY(entry) entries;     /* Singly-linked List. */
        ...
} *n1, *n2, *n3, *np;

SLIST_INIT(&head);                      /* Initialize the list. */

n1 = malloc(sizeof(struct entry));      /* Insert at the head. */
SLIST_INSERT_HEAD(&head, n1, entries);

n2 = malloc(sizeof(struct entry));      /* Insert after. */
SLIST_INSERT_AFTER(n1, n2, entries);

SLIST_REMOVE(&head, n2, entry, entries);/* Deletion. */
free(n2);

n3 = SLIST_FIRST(&head);
SLIST_REMOVE_HEAD(&head, entries);      /* Deletion from the head. */
free(n3);
                                        /* Forward traversal. */
SLIST_FOREACH(np, &head, entries)
        np-> ...

while (!SLIST_EMPTY(&head)) {           /* List Deletion. */
        n1 = SLIST_FIRST(&head);
        SLIST_REMOVE_HEAD(&head, entries);
        free(n1);
}

Simple Queues

A simple queue is headed by a structure defined by the SIMPLEQ_HEAD() macro. This structure contains a pair of pointers, one to the first element in the simple queue and the other to the last element in the simple queue. The elements are singly linked for minimum space and pointer manipulation overhead at the expense of O(n) removal for arbitrary elements. New elements can be added to the queue after an existing element, at the head of the queue, or at the end of the queue. A SIMPLEQ_HEAD structure is declared as follows:

SIMPLEQ_HEAD(HEADNAME, TYPE) head;

where HEADNAME is the name of the structure to be defined, and TYPE is the type of the elements to be linked into the simple queue. A pointer to the head of the simple queue can later be declared as:

struct HEADNAME *headp;

The names head and headp are user selectable.

The macro SIMPLEQ_ENTRY() declares a structure that connects the elements in the simple queue.

The macro SIMPLEQ_HEAD_INITIALIZER() provides a value which can be used to initialize a simple queue head at compile time, and is used at the point that the simple queue head variable is declared, like:

struct HEADNAME head = SIMPLEQ_HEAD_INITIALIZER(head);

The macro SIMPLEQ_INIT() initializes the simple queue referenced by head.

The macro SIMPLEQ_INSERT_HEAD() inserts the new element elm at the head of the simple queue.

The macro SIMPLEQ_INSERT_TAIL() inserts the new element elm at the end of the simple queue.

The macro SIMPLEQ_INSERT_AFTER() inserts the new element elm after the element listelm.

The macro SIMPLEQ_REMOVE() removes elm from the simple queue.

The macro SIMPLEQ_REMOVE_HEAD() removes the first element from the head of the simple queue. For optimum efficiency, elements being removed from the head of the queue should explicitly use this macro instead of the generic SIMPLQ_REMOVE() macro.

The macro SIMPLEQ_EMPTY() return true if the simple queue head has no elements.

The macro SIMPLEQ_FIRST() returns the first element of the simple queue head.

The macro SIMPLEQ_FOREACH() traverses the tail queue referenced by head in the forward direction, assigning each element in turn to var.

The macro SIMPLEQ_NEXT() returns the element after the element elm.

The macros prefixed with “STAILQ_” (STAILQ_HEAD(), STAILQ_HEAD_INITIALIZER(), STAILQ_ENTRY(), STAILQ_INIT(), STAILQ_INSERT_HEAD(), STAILQ_INSERT_TAIL(), STAILQ_INSERT_AFTER(), STAILQ_REMOVE_HEAD(), STAILQ_REMOVE(), STAILQ_FOREACH(), STAILQ_EMPTY(), STAILQ_FIRST(), and STAILQ_NEXT()) are functionally identical to these simple queue functions, and are provided for compatibility with FreeBSD.

Simple Queue Example

SIMPLEQ_HEAD(simplehead, entry) head;
struct simplehead *headp;               /* Simple queue head. */
struct entry {
        ...
        SIMPLEQ_ENTRY(entry) entries;   /* Simple queue. */
        ...
} *n1, *n2, *np;

SIMPLEQ_INIT(&head);                    /* Initialize the queue. */

n1 = malloc(sizeof(struct entry));      /* Insert at the head. */
SIMPLEQ_INSERT_HEAD(&head, n1, entries);

n1 = malloc(sizeof(struct entry));      /* Insert at the tail. */
SIMPLEQ_INSERT_TAIL(&head, n1, entries);

n2 = malloc(sizeof(struct entry));      /* Insert after. */
SIMPLEQ_INSERT_AFTER(&head, n1, n2, entries);
                                        /* Forward traversal. */
SIMPLEQ_FOREACH(np, &head, entries)
        np-> ...
                                        /* Delete. */
while (SIMPLEQ_FIRST(&head) != NULL)
        SIMPLEQ_REMOVE_HEAD(&head, entries);
if (SIMPLEQ_EMPTY(&head))               /* Test for emptiness. */
        printf("nothing to do\
");

Lists

A list is headed by a structure defined by the LIST_HEAD() macro. This structure contains a single pointer to the first element on the list. The elements are doubly linked so that an arbitrary element can be removed without traversing the list. New elements can be added to the list after an existing element, before an existing element, or at the head of the list. A LIST_HEAD structure is declared as follows:

LIST_HEAD(HEADNAME, TYPE) head;

where HEADNAME is the name of the structure to be defined, and TYPE is the type of the elements to be linked into the list. A pointer to the head of the list can later be declared as:

struct HEADNAME *headp;

The names head and headp are user selectable.

The macro LIST_ENTRY() declares a structure that connects the elements in the list.

The macro LIST_HEAD_INITIALIZER() provides a value which can be used to initialize a list head at compile time, and is used at the point that the list head variable is declared, like:

struct HEADNAME head = LIST_HEAD_INITIALIZER(head);

The macro LIST_INIT() initializes the list referenced by head.

The macro LIST_INSERT_HEAD() inserts the new element elm at the head of the list.

The macro LIST_INSERT_AFTER() inserts the new element elm after the element listelm.

The macro LIST_INSERT_BEFORE() inserts the new element elm before the element listelm.

The macro LIST_REMOVE() removes the element elm from the list.

The macro LIST_EMPTY() returns true if the list head has no elements.

The macro LIST_FIRST() returns the first element of the list head.

The macro LIST_FOREACH() traverses the list referenced by head in the forward direction, assigning each element in turn to var.

The macro LIST_NEXT() returns the element after the element elm.

List Example

LIST_HEAD(listhead, entry) head;
struct listhead *headp;         /* List head. */
struct entry {
        ...
        LIST_ENTRY(entry) entries;      /* List. */
        ...
} *n1, *n2, *np;

LIST_INIT(&head);                       /* Initialize the list. */

n1 = malloc(sizeof(struct entry));      /* Insert at the head. */
LIST_INSERT_HEAD(&head, n1, entries);

n2 = malloc(sizeof(struct entry));      /* Insert after. */
LIST_INSERT_AFTER(n1, n2, entries);

n2 = malloc(sizeof(struct entry));      /* Insert before. */
LIST_INSERT_BEFORE(n1, n2, entries);
                                        /* Forward traversal. */
LIST_FOREACH(np, &head, entries)
        np-> ...
                                        /* Delete. */
while (LIST_FIRST(&head) != NULL)
        LIST_REMOVE(LIST_FIRST(&head), entries);
if (LIST_EMPTY(&head))                  /* Test for emptiness. */
        printf("nothing to do\
");

Tail Queues

A tail queue is headed by a structure defined by the TAILQ_HEAD() macro. This structure contains a pair of pointers, one to the first element in the tail queue and the other to the last element in the tail queue. The elements are doubly linked so that an arbitrary element can be removed without traversing the tail queue. New elements can be added to the queue after an existing element, before an existing element, at the head of the queue, or at the end the queue. A TAILQ_HEAD structure is declared as follows:

TAILQ_HEAD(HEADNAME, TYPE) head;

where HEADNAME is the name of the structure to be defined, and TYPE is the type of the elements to be linked into the tail queue. A pointer to the head of the tail queue can later be declared as:

struct HEADNAME *headp;

The names head and headp are user selectable.

The macro TAILQ_ENTRY() declares a structure that connects the elements in the tail queue.

The macro TAILQ_HEAD_INITIALIZER() provides a value which can be used to initialize a tail queue head at compile time, and is used at the point that the tail queue head variable is declared, like:

struct HEADNAME head = TAILQ_HEAD_INITIALIZER(head);

The macro TAILQ_INIT() initializes the tail queue referenced by head.

The macro TAILQ_INSERT_HEAD() inserts the new element elm at the head of the tail queue.

The macro TAILQ_INSERT_TAIL() inserts the new element elm at the end of the tail queue.

The macro TAILQ_INSERT_AFTER() inserts the new element elm after the element listelm.

The macro TAILQ_INSERT_BEFORE() inserts the new element elm before the element listelm.

The macro TAILQ_REMOVE() removes the element elm from the tail queue.

The macro TAILQ_EMPTY() return true if the tail queue head has no elements.

The macro TAILQ_FIRST() returns the first element of the tail queue head.

The macro TAILQ_FOREACH() traverses the tail queue referenced by head in the forward direction, assigning each element in turn to var.

The macro TAILQ_FOREACH_REVERSE() traverses the tail queue referenced by head in the reverse direction, assigning each element in turn to var.

The macro TAILQ_NEXT() returns the element after the element elm.

The macro TAILQ_CONCAT() concatenates the tail queue headed by head2 onto the end of the one headed by head1 removing all entries from the former.

Tail Queue Example

TAILQ_HEAD(tailhead, entry) head;
struct tailhead *headp;         /* Tail queue head. */
struct entry {
        ...
        TAILQ_ENTRY(entry) entries;     /* Tail queue. */
        ...
} *n1, *n2, *np;

TAILQ_INIT(&head);                      /* Initialize the queue. */

n1 = malloc(sizeof(struct entry));      /* Insert at the head. */
TAILQ_INSERT_HEAD(&head, n1, entries);

n1 = malloc(sizeof(struct entry));      /* Insert at the tail. */
TAILQ_INSERT_TAIL(&head, n1, entries);

n2 = malloc(sizeof(struct entry));      /* Insert after. */
TAILQ_INSERT_AFTER(&head, n1, n2, entries);

n2 = malloc(sizeof(struct entry));      /* Insert before. */
TAILQ_INSERT_BEFORE(n1, n2, entries);
                                        /* Forward traversal. */
TAILQ_FOREACH(np, &head, entries)
        np-> ...
                                        /* Reverse traversal. */
TAILQ_FOREACH_REVERSE(np, &head, tailhead, entries)
        np-> ...
                                        /* Delete. */
while (TAILQ_FIRST(&head) != NULL)
        TAILQ_REMOVE(&head, TAILQ_FIRST(&head), entries);
if (TAILQ_EMPTY(&head))                 /* Test for emptiness. */
        printf("nothing to do\
");

Circular Queues

A circular queue is headed by a structure defined by the CIRCLEQ_HEAD() macro. This structure contains a pair of pointers, one to the first element in the circular queue and the other to the last element in the circular queue. The elements are doubly linked so that an arbitrary element can be removed without traversing the queue. New elements can be added to the queue after an existing element, before an existing element, at the head of the queue, or at the end of the queue. A CIRCLEQ_HEAD structure is declared as follows:

CIRCLEQ_HEAD(HEADNAME, TYPE) head;

where HEADNAME is the name of the structure to be defined, and TYPE is the type of the elements to be linked into the circular queue. A pointer to the head of the circular queue can later be declared as:

struct HEADNAME *headp;

The names head and headp are user selectable.

The macro CIRCLEQ_ENTRY() declares a structure that connects the elements in the circular queue.

The macro CIRCLEQ_HEAD_INITIALIZER() provides a value which can be used to initialize a circular queue head at compile time, and is used at the point that the circular queue head variable is declared, like:

struct HEADNAME() head() = CIRCLEQ_HEAD_INITIALIZER(head());

The macro CIRCLEQ_INIT() initializes the circular queue referenced by head.

The macro CIRCLEQ_INSERT_HEAD() inserts the new element elm at the head of the circular queue.

The macro CIRCLEQ_INSERT_TAIL() inserts the new element elm at the end of the circular queue.

The macro CIRCLEQ_INSERT_AFTER() inserts the new element elm after the element listelm.

The macro CIRCLEQ_INSERT_BEFORE() inserts the new element elm before the element listelm.

The macro CIRCLEQ_REMOVE() removes the element elm from the circular queue.

The macro CIRCLEQ_EMPTY() return true if the circular queue head has no elements.

The macro CIRCLEQ_FIRST() returns the first element of the circular queue head.

The macro CIRCLEQ_FOREACH() traverses the circle queue referenced by head in the forward direction, assigning each element in turn to var. Each element is assigned exactly once.

The macro CIRCLEQ_FOREACH_REVERSE() traverses the circle queue referenced by head in the reverse direction, assigning each element in turn to var. Each element is assigned exactly once.

The macro CIRCLEQ_LAST() returns the last element of the circular queue head.

The macro CIRCLEQ_NEXT() returns the element after the element elm.

The macro CIRCLEQ_PREV() returns the element before the element elm.

The macro CIRCLEQ_LOOP_NEXT() returns the element after the element elm. If elm was the last element in the queue, the first element is returned.

The macro CIRCLEQ_LOOP_PREV() returns the element before the element elm. If elm was the first element in the queue, the last element is returned.

Circular Queue Example

CIRCLEQ_HEAD(circleq, entry) head;
struct circleq *headp;                  /* Circular queue head. */
struct entry {
        ...
        CIRCLEQ_ENTRY(entry) entries;   /* Circular queue. */
        ...
} *n1, *n2, *np;

CIRCLEQ_INIT(&head);                    /* Initialize circular queue. */


n1 = malloc(sizeof(struct entry));      /* Insert at the head. */
CIRCLEQ_INSERT_HEAD(&head, n1, entries);

n1 = malloc(sizeof(struct entry));      /* Insert at the tail. */
CIRCLEQ_INSERT_TAIL(&head, n1, entries);

n2 = malloc(sizeof(struct entry));      /* Insert after. */
CIRCLEQ_INSERT_AFTER(&head, n1, n2, entries);

n2 = malloc(sizeof(struct entry));      /* Insert before. */
CIRCLEQ_INSERT_BEFORE(&head, n1, n2, entries);
                                        /* Forward traversal. */
CIRCLEQ_FOREACH(np, &head, entries)
        np-> ...
                                        /* Reverse traversal. */
CIRCLEQ_FOREACH_REVERSE(np, &head, entries)
        np-> ...
                                        /* Delete. */
while (CIRCLEQ_FIRST(&head) != (void *)&head)
        CIRCLEQ_REMOVE(&head, CIRCLEQ_FIRST(&head), entries);
if (CIRCLEQ_EMPTY(&head))               /* Test for emptiness. */
        printf("nothing to do\
");

Attributes

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Interface Stability
Committed

See Also

queue(3EXT)attributes(5)

Notes

Some of these macros or functions perform no error checking, and invalid usage leads to undefined behavior. In the case of macros or functions that expect their arguments to be elements that are present in the list or queue, passing an element that is not present is invalid.

The queue functions first appeared in 4.4BSD. The SIMPLEQ functions first appeared in NetBSD 1.2. The SLIST and STAILQ functions first appeared in FreeBSD 2.1.5. The CIRCLEQ_LOOP functions first appeared in NetBSD 4.0.