Skip to content

Instantly share code, notes, and snippets.

View nonakap's full-sized avatar

Kimihiro Nonaka nonakap

View GitHub Profile
@nonakap
nonakap / container_of.h
Created October 9, 2024 01:06
NetBSDのcontainer_of()マクロでvoid *を特別扱いする
#if defined(__COVERITY__) || defined(__LGTM_BOT__)
#define __validate_container_of(PTR, TYPE, FIELD) 0
#define __validate_const_container_of(PTR, TYPE, FIELD) 0
#else
#define __validate_container_of(PTR, TYPE, FIELD) \
(0 * sizeof(__builtin_choose_expr( \
__builtin_types_compatible_p(typeof(PTR), void *), \
(const char *)(PTR), (PTR)) - \
__builtin_choose_expr(__builtin_types_compatible_p(typeof(PTR), \
void *), (const char *)&(((TYPE *)(((char *)(PTR)) - \
@nonakap
nonakap / pkgsrc-textproc-jnv.shar
Last active April 4, 2024 04:33
New pkgsrc textproc/jnv: an interactive JSON viewer and jq filter editor.
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# textproc/jnv
# textproc/jnv/DESCR
# textproc/jnv/Makefile
@nonakap
nonakap / pkgsrc-editors-imhex-1.31.0.shar
Created November 2, 2023 10:38
new pkgsrc: editors/imhex
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# editors/imhex/DESCR
# editors/imhex/Makefile
# editors/imhex/PLIST
@nonakap
nonakap / pkgsrc-net-net-snmp-for-9.99.104.diff
Created November 22, 2022 14:37
pkgsrc/net/net-snmp: Fix build failure for NetBSD 9.99.104 inpcb changes.
diff --git a/net/net-snmp/Makefile.common b/net/net-snmp/Makefile.common
index ca1a67010ce..13f95142631 100644
--- a/net/net-snmp/Makefile.common
+++ b/net/net-snmp/Makefile.common
@@ -3,6 +3,7 @@
# used by net/py-netsnmp/Makefile
DISTNAME= net-snmp-5.9.3
+PKGREVISION= 1
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=net-snmp/}
@nonakap
nonakap / dhcpd.conf
Created September 14, 2022 09:17
dhcpd.conf for NetBSD/x64
host netbsd-x86 {
hardware ethernet XX:XX:XX:XX:XX:XX;
fixed-address netbsd-x86;
option host-name "netbsd-x86";
if substring (option vendor-class-identifier, 0, 9) = "PXEClient" {
if option client-arch = 00:06 {
filename "bootia32.efi";
} else if option client-arch = 00:07 or option client-arch = 00:09 {
filename "bootx64.efi";
} else {
@nonakap
nonakap / pkgsrc-devel-gitui.shar
Created April 8, 2022 08:35
New pkgsrc devel/gitui: Terminal UI for git
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# devel/gitui
# devel/gitui/DESCR
# devel/gitui/Makefile
@nonakap
nonakap / pkgsrc-devel-meson-restore-fix_elf-test.shar
Created February 2, 2022 14:10
pkgsrc/devel/meson 0.60.3nb2でinstall_rpathが効いていないことを確認するためのもの
# ./TEST.sh を実行して最後に"TEST"と表示されればrpathの書き換えに成功しています。
# /tmp/local/bin/fixelf-test: Shared object "libtestso.so.0" not foundの場合はrpathの書き換えが行われていません、多分。件のパッチ(※1)が当たっている場合はこっちになるはずです。
# (※1) 件のパッチ: http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/devel/meson/patches/patch-mesonbuild_scripts_depfixer.py?rev=1.3&content-type=text/x-cvsweb-markup&only_with_tag=MAIN
#
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
@nonakap
nonakap / envstat-I-result-B550GTA.txt
Created July 3, 2021 07:11
NetBSD envstat(8) result on BIOSTAR B550GTA
nonaka@netbsd[~]$ envstat -I
Current CritMax WarnMax WarnMin CritMin Unit
[acpitz0]
temperature: 22.000 127.000 degC
[amdzentemp0]
cpu0 temperature: 32.500 degC
cpu0 ccd0 temperature: 33.250 degC
cpu0 ccd1 temperature: 31.500 degC
[itesio0]
Temp0: 22.000 degC
@nonakap
nonakap / envsys-B550GTA.conf
Last active July 3, 2021 07:05
NetBSD envstat config file for BIOSTAR B550GTA IT8625 sensors.
itesio0 {
sensor0 { description = "ACPI Thermal Zone Temperature"; }
sensor1 { description = "CPU Temperature"; }
sensor2 { description = "System Temperature"; }
sensor3 { description = "CPU Core Voltage"; }
sensor4 { description = "DDR Memory Voltage"; }
sensor5 { description = "+12V"; rfact = 61500; }
sensor6 { description = "+5V"; rfact = 25300; }
sensor7 { description = "VDPP Voltage"; }
sensor8 { description = "Chipset Voltage"; }
@nonakap
nonakap / nbsd-pr55189.diff
Last active May 14, 2021 01:03
Fix NetBSD PR/55189
diff --git a/sys/dev/ic/nvme.c b/sys/dev/ic/nvme.c
index f371baeb0a0..76445d3fe9e 100644
--- a/sys/dev/ic/nvme.c
+++ b/sys/dev/ic/nvme.c
@@ -564,10 +564,33 @@ nvme_detach(struct nvme_softc *sc, int flags)
return 0;
}
+bool
+nvme_set_shutdown_reason(struct nvme_softc *sc, int how __unused)