<div dir="ltr">Kamil,<div><br></div><div>I will be sure to Cc another set of eyes onto the patchset next time, preferrably</div><div>another FreeBSD committer. Thank you again for the advice.</div><div><br></div><div>Jake Freeland</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Oct 11, 2022 at 4:37 AM Kamil Konieczny <<a href="mailto:kamil.konieczny@linux.intel.com">kamil.konieczny@linux.intel.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Jake,<br>
<br>
On 2022-10-07 at 18:27:52 -0500, Jake Freeland wrote:<br>
> This header attempts to be a simple drop-in to enable FreeBSD<br>
> support in a given source file. It includes macro substitutions<br>
> that replace Linux-specific phrases with their FreeBSD equivalents.<br>
> <br>
> Signed-off-by: Jake Freeland <<a href="mailto:jfree@freebsd.org" target="_blank">jfree@freebsd.org</a>><br>
<br>
Your patchset got merged but please in future ask someone from<br>
FreeBSD community for review of changes related to FreeBSD.<br>
<br>
Ideally, if you know who might review it, put that person on Cc<br>
just before your s-b, so it will look like<br>
<br>
Cc: Name Here <<a href="http://e-mail-address_from_freebsd.org" rel="noreferrer" target="_blank">e-mail-address_from_freebsd.org</a>><br>
Signed-off-by: Jake Freeland <<a href="mailto:jfree@freebsd.org" target="_blank">jfree@freebsd.org</a>><br>
<br>
btw this is only example, it may outside from <a href="http://freebsd.org" rel="noreferrer" target="_blank">freebsd.org</a><br>
<br>
Regards,<br>
Kamil<br>
<br>
> ---<br>
> lib/igt_core.h | 4 ++<br>
> lib/igt_freebsd.h | 118 ++++++++++++++++++++++++++++++++++++++++++++++<br>
> 2 files changed, 122 insertions(+)<br>
> create mode 100644 lib/igt_freebsd.h<br>
> <br>
> diff --git a/lib/igt_core.h b/lib/igt_core.h<br>
> index f21723de..a6b4b5ae 100644<br>
> --- a/lib/igt_core.h<br>
> +++ b/lib/igt_core.h<br>
> @@ -43,6 +43,10 @@<br>
> #include <getopt.h><br>
> #include <unistd.h><br>
> <br>
> +#ifdef __FreeBSD__<br>
> +#include "igt_freebsd.h"<br>
> +#endif<br>
> +<br>
> #ifndef IGT_LOG_DOMAIN<br>
> #define IGT_LOG_DOMAIN (NULL)<br>
> #endif<br>
> diff --git a/lib/igt_freebsd.h b/lib/igt_freebsd.h<br>
> new file mode 100644<br>
> index 00000000..53fa8fb6<br>
> --- /dev/null<br>
> +++ b/lib/igt_freebsd.h<br>
> @@ -0,0 +1,118 @@<br>
> +/*<br>
> + * SPDX-License-Identifier: MIT<br>
> + *<br>
> + * Copyright (c) 2022, Jake Freeland <jfree@FreeBSD.org><br>
> + */<br>
> +<br>
> +#if !defined(IGT_FREEBSD_H)<br>
> +<br>
> +#if !defined(__FreeBSD__)<br>
> +#error "This header is only for FreeBSD platform."<br>
> +#endif<br>
> +<br>
> +#define IGT_FREEBSD_H<br>
> +<br>
> +#include <sys/consio.h><br>
> +#include <sys/endian.h><br>
> +#include <sys/errno.h><br>
> +#include <sys/mman.h><br>
> +#include <sys/mount.h><br>
> +#include <sys/sched.h><br>
> +#include <sys/types.h><br>
> +#include <sys/wait.h><br>
> +#include <sys/watchdog.h><br>
> +<br>
> +#include <libgen.h><br>
> +#include <limits.h><br>
> +#include <pthread.h><br>
> +#include <setjmp.h><br>
> +#include <signal.h><br>
> +#include <unistd.h><br>
> +<br>
> +/*<br>
> + * Proper substitutions:<br>
> + * The following macros replace Linux-specific functions<br>
> + * and macros with their FreeBSD equivalents.<br>
> + */<br>
> +<br>
> +typedef int32_t __s32;<br>
> +typedef uint32_t __u32;<br>
> +typedef uint64_t __u64;<br>
> +<br>
> +typedef ino_t ino64_t;<br>
> +typedef sig_t sighandler_t;<br>
> +<br>
> +#define jmp_buf sigjmp_buf<br>
> +<br>
> +#define PTRACE_TRACEME PT_TRACE_ME<br>
> +#define PTRACE_ATTACH PT_ATTACH<br>
> +#define PTRACE_PEEKDATA PT_READ_D<br>
> +#define PTRACE_POKEDATA PT_WRITE_D<br>
> +#define PTRACE_DETACH PT_DETACH<br>
> +<br>
> +#define I2C_RDWR I2CRDWR<br>
> +#define I2C_M_RD IIC_M_RD<br>
> +#define i2c_msg iic_msg<br>
> +#define i2c_rdwr_ioctl_data iic_rdwr_data<br>
> +<br>
> +#define bswap_32(x) bswap32(x)<br>
> +<br>
> +#define _IOC_TYPE(nr) (((nr) >> 8) & 255)<br>
> +<br>
> +#define SYS_getdents64 SYS_freebsd11_getdents<br>
> +<br>
> +#define mount(src, dest, fstype, flags, data) \<br>
> + mount(fstype, dest, flags, data)<br>
> +<br>
> +/*<br>
> + * Improper substitutions:<br>
> + * The following macros are temporary replacements for functions<br>
> + * and macros that exist on Linux and do not exist on FreeBSD.<br>
> + */<br>
> +<br>
> +#define ETIME ETIMEDOUT<br>
> +<br>
> +#define MAP_POPULATE MAP_PREFAULT_READ<br>
> +<br>
> +#define MADV_HUGEPAGE MADV_SEQUENTIAL<br>
> +#define MADV_DONTFORK MADV_NOSYNC<br>
> +<br>
> +#define WDIOC_KEEPALIVE WDIOCPATPAT<br>
> +<br>
> +#define SCHED_RESET_ON_FORK 0<br>
> +#define SCHED_IDLE SCHED_OTHER<br>
> +<br>
> +#define gettid() getpid()<br>
> +<br>
> +#define pthread_sigqueue(pid, signo, value) \<br>
> + sigqueue(pid, signo, value)<br>
> +<br>
> +#define signalfd(fd, mask, flags) -ENOSYS<br>
> +#define timerfd_create(c, f) -ENOSYS<br>
> +#define timerfd_settime(fd, f, n, o) -ENOSYS<br>
> +<br>
> +/*<br>
> + * Macro conflict resolution.<br>
> + */<br>
> +<br>
> +#undef ALIGN<br>
> +#undef PAGE_SIZE<br>
> +<br>
> +/*<br>
> + * Missing Linux structures.<br>
> + */<br>
> +<br>
> +struct signalfd_siginfo {<br>
> + uint32_t ssi_signo;<br>
> + uint32_t ssi_pid;<br>
> +};<br>
> +<br>
> +struct kmod_module {<br>
> + size_t size;<br>
> +};<br>
> +<br>
> +typedef struct {<br>
> + char state;<br>
> +} proc_t;<br>
> +<br>
> +#endif /* IGT_FREEBSD_H */<br>
> -- <br>
> 2.37.3<br>
> <br>
</blockquote></div>