IEEE1284_REF(3)
β¨ IEEE1284_REF(3) β¨
okay so bestie, this is a page from the Functions corner of the manual (section 3), and it's about ieee1284_ref and ieee1284_unref β the little duo that edits a port's reference count. yes it's short. yes it's important. let's get into it π
πΈ NAME πΈ
ieee1284_ref, ieee1284_unref β the way you modify a port's reference count, fr fr
π SYNOPSIS π
#include <ieee1284.h>
int ieee1284_ref(struct parport *port);
int ieee1284_unref(struct parport *port);
like, that's it. two functions. one header. iconic honestly π¦
π DESCRIPTION π
so here's the vibe: if you wanna free the port list you got from ieee1284_find_ports, but you're planning to open one of those ports later on, you gotta protect it from getting destroyed when ieee1284_free_ports does its thing. π
and how do you do that? every port has a reference count, and you use ieee1284_ref to increment it, and ieee1284_unref to decrement it. that's the whole mechanic. lowkey elegant.
β οΈ okay this part is the important part, don't skip it β οΈ
if you use ieee1284_ref at any stage, you must later call ieee1284_unref to relinquish the extra reference. if you don't do this, the resources associated with the port will not be cleaned up. like, they just sit there. leaking. sad. π
and the flip side, bestie, is equally serious: if you have not previously used ieee1284_ref on a port, you must not use ieee1284_unref on it. periodt. π«Ά
π RETURN VALUE π
both of these return the number of references held after the increment or decrement. so like, the post-math count. cute. β
π SEE ALSO π
go read that one next, iykyk π§
π AUTHOR π
Tim Waugh <twaugh@redhat.com>
- Author.
(hi tim, king π)
π COPYRIGHT π
Copyright Β© 2001-2003 Tim Waugh
and that's the whole page babes π
the source/version tag on this one is IEEE1284_REF(3), dated 09/18/2007 β yes, 2007, she's vintage and she's still serving. mwah, go refcount responsibly πΈβ¨π¦
π¦ where this page comes from
- alpine 3.24: libieee1284-doc 0.2.11-r4 Β· GPL-2.0-or-later
- debian bookworm: libieee1284-3-dev 0.2.11-14
- debian trixie: libieee1284-3-dev 0.2.11-14.1+b1
- opensuse-leap 16.0: libieee1284-devel 0.2.11-bp160.1.13 Β· GPL-2.0-or-later AND MIT
- opensuse-leap 16.0: libieee1284-devel 0.2.11-bp160.1.13 Β· GPL-2.0-or-later AND MIT
- opensuse-leap 16.0: libieee1284-devel 0.2.11-bp160.1.13 Β· GPL-2.0-or-later AND MIT
- opensuse-leap 16.0: libieee1284-devel 0.2.11-bp160.1.13 Β· GPL-2.0-or-later AND MIT
- ubuntu jammy: libieee1284-3-dev 0.2.11-14build2
- ubuntu noble: libieee1284-3-dev 0.2.11-14.1build1
- ubuntu questing: libieee1284-3-dev 0.2.11-14.1build1
- ubuntu resolute: libieee1284-3-dev 0.2.11-14.1build2
- ubuntu stonking: libieee1284-3-dev 0.2.11-15 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms