Skip to content

Instantly share code, notes, and snippets.

View lundman's full-sized avatar

Jorgen Lundman lundman

View GitHub Profile
@lundman
lundman / 10.10patch
Last active April 11, 2018 08:08
10.10 build fix
diff --git a/include/sys/ZFSDataset.h b/include/sys/ZFSDataset.h
index 7ca3c25..c45c2e3 100644
--- a/include/sys/ZFSDataset.h
+++ b/include/sys/ZFSDataset.h
@@ -28,6 +28,7 @@
#ifdef __cplusplus
#include <IOKit/storage/IOMedia.h>
+#include <AvailabilityMacros.h>
@lundman
lundman / arc.c.patch
Created July 13, 2018 03:29
Temporary kmem_cache_alloc work around
diff --git a/usr/src/uts/common/fs/zfs/arc.c b/usr/src/uts/common/fs/zfs/arc.c
index b2cc3bd..d714f60 100644
--- a/usr/src/uts/common/fs/zfs/arc.c
+++ b/usr/src/uts/common/fs/zfs/arc.c
@@ -3713,6 +3713,13 @@ arc_hdr_realloc_crypt(arc_buf_hdr_t *hdr, boolean_t need_crypt)
} else {
arc_hdr_clear_flags(nhdr, ARC_FLAG_PROTECTED);
}
+
+ // Due to lazy cons/dest in kmem_cache - clear it
diff --git a/module/zfs/dsl_deadlist.c b/module/zfs/dsl_deadlist.c
index a2e2a1f..9a82a18 100644
--- a/module/zfs/dsl_deadlist.c
+++ b/module/zfs/dsl_deadlist.c
@@ -105,6 +105,11 @@ dsl_deadlist_open(dsl_deadlist_t *dl, objset_t *os, uint64_t object)
mutex_init(&dl->dl_lock, NULL, MUTEX_DEFAULT, NULL);
dl->dl_os = os;
dl->dl_object = object;
+ dl->dl_dbuf = NULL;
+ dl->dl_oldfmt = B_TRUE;
@lundman
lundman / shmget_osm.c
Created December 3, 2020 06:19
Run oracbledb client libraries on illumos/OmniOS
/*
* Solaris defines
* int shmget_osm(key_t key, size_t size, int shmflg,
* size_t granule_size);
*
* Which takes one additional argument "granule_size" to regular
* int shmget(key_t key, size_t size, int shmflg);
*
* This is a wrapper library to attempt to support it enough for
* Oracle DB client library to work.
@lundman
lundman / lfswatcher.c
Created December 3, 2020 06:42
Small tool using libfswatcher to read a list of files to monitor - requires patched libfswatcher for watch_access method.
/*
* Quick & Dirty libfswatch wrapper
*
* gcc -o lfswatch lfswatch.c -I/export/home/lundman/fswatch-1.15.0/libfswatch/src/libfswatch/c -L/export/home/lundman/fswatch-1.15.0/libfswatch/src/libfswatch/.libs -R/export/home/lundman/fswatch-1.15.0/libfswatch/src/libfswatch/.libs -lfswatch
*
* - lundman
*/
#include <stdio.h>
#include <unistd.h>
@lundman
lundman / time.h
Last active March 23, 2025 21:02
time.h style timers for macOS
#include <sys/stdtypes.h>
#include <stdbool.h>
#include <mach/boolean.h>
#include <sys/errno.h>
#include <stdlib.h>
#include <dispatch/dispatch.h>
#if !defined(MAC_OS_X_VERSION_10_12) || \
(MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12)
@lundman
lundman / patch.diff
Created April 13, 2022 05:53
Working around expired certificate with OmniOS pkg
For output like:
Framework error: code: 60 reason: SSL certificate problem: certificate has expir
ed
URL: 'http://pkg.omniti.com/omnios/r151022'
Whilst trying to update 151016 OmniOS TI to CE, and unable to find certificates both still valid, and not too-new.
/usr/lib/python2.6/vendor-packages/pkg/client/transport# dtff -rub engine.py orig-engine.py
--- engine.py Wed Apr 13 12:02:48 2022
@lundman
lundman / github.md
Last active April 21, 2022 08:02
github collapsable comments

<details>
<summary> code diff </summary>
<p>

```
text
```
\

@lundman
lundman / wrapper.c
Last active November 18, 2022 08:48
inline assembly to call sysv_abi from ms_abi
/* Update 3 - experimenting with explicit first, all args look correct */
void XXXzfs_blake3_compress_xof_sse2(const uint32_t cv[8],
const uint8_t block[BLAKE3_BLOCK_LEN], uint8_t block_len,
uint64_t counter, uint8_t flags, uint8_t out[64])
{
long ret;
__asm__ (
"mov %[p6], %%r9 \n\t"
"mov %[p5], %%r8 \n\t"
@lundman
lundman / asm.S
Created February 2, 2023 06:01
M1 ARM64 assembler
// Changes needed to assemble on macOS (from Linux) on M1/ARM64e
/*
* semi-colon is comment, so use secret %%
* M1 is 64 bit only
* and needs "_" prepended
*/
#define ENTRY(x) \