Skip to content

Commit d02ea51

Browse files
robnbehlendorf
authored andcommitted
libspl: init/fini
Sponsored-by: https://despairlabs.com/sponsor/ Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Rob Norris <[email protected]> Closes #17861
1 parent 4e3b889 commit d02ea51

File tree

5 files changed

+82
-0
lines changed

5 files changed

+82
-0
lines changed

lib/libspl/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ libspl_la_SOURCES = \
2121
%D%/getexecname.c \
2222
%D%/kmem.c \
2323
%D%/kstat.c \
24+
%D%/libspl.c \
2425
%D%/list.c \
2526
%D%/mkdirp.c \
2627
%D%/mutex.c \

lib/libspl/include/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ libspl_HEADERS = \
44
%D%/atomic.h \
55
%D%/libgen.h \
66
%D%/libshare.h \
7+
%D%/libspl.h \
78
%D%/statcommon.h \
89
%D%/stdlib.h \
910
%D%/string.h \

lib/libspl/include/libspl.h

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// SPDX-License-Identifier: CDDL-1.0
2+
/*
3+
* CDDL HEADER START
4+
*
5+
* The contents of this file are subject to the terms of the
6+
* Common Development and Distribution License (the "License").
7+
* You may not use this file except in compliance with the License.
8+
*
9+
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10+
* or https://opensource.org/licenses/CDDL-1.0.
11+
* See the License for the specific language governing permissions
12+
* and limitations under the License.
13+
*
14+
* When distributing Covered Code, include this CDDL HEADER in each
15+
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16+
* If applicable, add the following below this CDDL HEADER, with the
17+
* fields enclosed by brackets "[]" replaced with your own identifying
18+
* information: Portions Copyright [yyyy] [name of copyright owner]
19+
*
20+
* CDDL HEADER END
21+
*/
22+
/*
23+
* Copyright (c) 2025, Rob Norris <[email protected]>
24+
*/
25+
26+
#ifndef _LIBSPL_H
27+
#define _LIBSPL_H extern __attribute__((visibility("default")))
28+
29+
#ifdef __cplusplus
30+
extern "C" {
31+
#endif
32+
33+
_LIBSPL_H void libspl_init(void);
34+
_LIBSPL_H void libspl_fini(void);
35+
36+
#ifdef __cplusplus
37+
};
38+
#endif
39+
40+
#endif /* _LIBSPL_H */

lib/libspl/libspl.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// SPDX-License-Identifier: CDDL-1.0
2+
/*
3+
* CDDL HEADER START
4+
*
5+
* The contents of this file are subject to the terms of the
6+
* Common Development and Distribution License (the "License").
7+
* You may not use this file except in compliance with the License.
8+
*
9+
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10+
* or https://opensource.org/licenses/CDDL-1.0.
11+
* See the License for the specific language governing permissions
12+
* and limitations under the License.
13+
*
14+
* When distributing Covered Code, include this CDDL HEADER in each
15+
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16+
* If applicable, add the following below this CDDL HEADER, with the
17+
* fields enclosed by brackets "[]" replaced with your own identifying
18+
* information: Portions Copyright [yyyy] [name of copyright owner]
19+
*
20+
* CDDL HEADER END
21+
*/
22+
/*
23+
* Copyright (c) 2025, Rob Norris <[email protected]>
24+
*/
25+
26+
#include <libspl.h>
27+
28+
void
29+
libspl_init(void)
30+
{
31+
}
32+
33+
void
34+
libspl_fini(void)
35+
{
36+
}

lib/libzpool/kernel.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,8 @@ kernel_init(int mode)
505505
{
506506
extern uint_t rrw_tsd_key;
507507

508+
libspl_init();
509+
508510
umem_nofail_callback(umem_out_of_memory);
509511

510512
physmem = sysconf(_SC_PHYS_PAGES);
@@ -543,6 +545,8 @@ kernel_fini(void)
543545
system_taskq_fini();
544546

545547
random_fini();
548+
549+
libspl_fini();
546550
}
547551

548552
int

0 commit comments

Comments
 (0)