# /usr/src/sys/contrib/openzfs/include/sys/fs/zfs.h:306:1: error: unknown type name 'boolean_t'



## i.am.the.problem (Jul 22, 2022)

I'm trying to build an application that uses libzfs_core.h


```
In file included from /usr/src/sys/contrib/openzfs/include/libzfs_core.h:35:
/usr/src/sys/contrib/openzfs/include/sys/fs/zfs.h:306:1: error: unknown type name 'boolean_t'
boolean_t zfs_prop_readonly(zfs_prop_t);
^
/usr/src/sys/contrib/openzfs/include/sys/fs/zfs.h:307:1: error: unknown type name 'boolean_t'
boolean_t zfs_prop_visible(zfs_prop_t prop);

Lots more errors about the same thing...
```

My Makefile.am is as follows:


```
bin_PROGRAMS= \
    ztdsd-daemon

ztdsd_daemon_SOURCES= \
    main.cpp \
    serversocket.cpp \
    clientsocket.cpp \
    ztdsp_packetizer.cpp \
    transaction_manager.cpp \
    statusfile.cpp

ztdsd_daemon_CXXFLAGS= @DEPS_CFLAGS@ \
 -Wall \
 -pthread \
 -std="c++11" \
 -DNEED_SOLARIS_BOOLEAN \
 -I/usr/src/sys/contrib/openzfs/include


ztdsd_daemon_LDFLAGS= -export-dynamic -rdynamic $(DEPS_LIBS) -lzfs
```

Its my understanding that the NEED_SOLARIS_BOOLEAN define should enable the 


```
typedef enum { B_FALSE, B_TRUE }    boolean_t;
```

in /usr/src/sys/contrib/openzfs/include/os/freebsd/spl/sys/types.h

Any ideas why this isn't working?


----------



## i.am.the.problem (Jul 22, 2022)

I need to use methods from libzfs.h which are not available from libzfs_core.h.

So now I have the following Makefile.am:


```
bin_PROGRAMS= \
    ztdsd-daemon

ztdsd_daemon_SOURCES= \
    main.cpp \
    serversocket.cpp \
    clientsocket.cpp \
    ztdsp_packetizer.cpp \
    transaction_manager.cpp \
    statusfile.cpp

ztdsd_daemon_CXXFLAGS= @DEPS_CFLAGS@ \
 -Wall \
 -pthread \
 -std="c++11" \
 -DNEED_SOLARIS_BOOLEAN \
 -I/usr/src/sys/contrib/openzfs/lib/libspl/include/os/freebsd \
 -I/usr/src/sys/contrib/openzfs/include \
 -I/usr/src/sys/contrib/openzfs/lib/libspl/include


ztdsd_daemon_LDFLAGS= -export-dynamic -rdynamic $(DEPS_LIBS) -lzfs
```

But get redefinition errors during compilation:


```
In file included from /usr/src/sys/contrib/openzfs/include/libzfs.h:38:
In file included from /usr/local/include/libnvpair.h:29:
/usr/local/include/nvpair.h:37:17: error: typedef redefinition with different types ('int64_t' (aka 'long') vs 'long long')
typedef int64_t hrtime_t;
                ^
/usr/src/sys/contrib/openzfs/lib/libspl/include/sys/time.h:78:20: note: previous definition is here
typedef long long               hrtime_t;
```


----------



## i.am.the.problem (Jul 22, 2022)

If I edit /usr/src/sys/contrib/openzfs/lib/libspl/include/sys/time.h to remove the hrtime_t typedef my application compiles.


```
//typedef       long long               hrtime_t;
typedef struct timespec         timespec_t;

//static inline hrtime_t
static inline long long
```

I'll need to produce a patch which will be applied by a port though.


----------

