diff mbox series

[06/32] bsd-user: Add bsd-proc.c to meson.build

Message ID 20230827155746.84781-7-kariem.taha2.7@gmail.com
State New
Headers show
Series bsd-user: Implement freebsd process related system calls. | expand

Commit Message

Karim Taha Aug. 27, 2023, 3:57 p.m. UTC
From: Warner Losh <imp@bsdimp.com>

Signed-off-by: Warner Losh <imp@bsdimp.com>
Signed-off-by: Karim Taha <kariem.taha2.7@gmail.com>
---
 bsd-user/bsd-proc.h  | 4 ++++
 bsd-user/meson.build | 6 ++++++
 2 files changed, 10 insertions(+)

Comments

Richard Henderson Aug. 29, 2023, 7:17 p.m. UTC | #1
On 8/27/23 08:57, Karim Taha wrote:
> From: Warner Losh <imp@bsdimp.com>
> 
> Signed-off-by: Warner Losh <imp@bsdimp.com>
> Signed-off-by: Karim Taha <kariem.taha2.7@gmail.com>
> ---
>   bsd-user/bsd-proc.h  | 4 ++++
>   bsd-user/meson.build | 6 ++++++
>   2 files changed, 10 insertions(+)
> 
> diff --git a/bsd-user/bsd-proc.h b/bsd-user/bsd-proc.h
> index a1061bffb8..048773a75d 100644
> --- a/bsd-user/bsd-proc.h
> +++ b/bsd-user/bsd-proc.h
> @@ -22,6 +22,10 @@
>   
>   #include <sys/resource.h>
>   
> +#include "qemu-bsd.h"
> +#include "gdbstub/syscalls.h"
> +#include "qemu/plugin.h"
> +
>   /* exit(2) */
>   static inline abi_long do_bsd_exit(void *cpu_env, abi_long arg1)
>   {
> diff --git a/bsd-user/meson.build b/bsd-user/meson.build
> index 5243122fc5..b97fce1472 100644
> --- a/bsd-user/meson.build
> +++ b/bsd-user/meson.build
> @@ -7,6 +7,7 @@ bsd_user_ss = ss.source_set()
>   common_user_inc += include_directories('include')
>   
>   bsd_user_ss.add(files(
> +  'bsd-proc.c',
>     'bsdload.c',
>     'elfload.c',
>     'main.c',
> @@ -16,6 +17,11 @@ bsd_user_ss.add(files(
>     'uaccess.c',
>   ))

Ok so far.

>   
> +elf = cc.find_library('elf', required: true)
> +procstat = cc.find_library('procstat', required: true)
> +kvm = cc.find_library('kvm', required: true)
> +bsd_user_ss.add(elf, procstat, kvm)

What are these for?  Particularly kvm?


r~
Karim Taha Sept. 11, 2023, 10:45 p.m. UTC | #2
Richard Henderson <richard.henderson@linaro.org> wrote:

>> +elf = cc.find_library('elf', required: true)
>> +procstat = cc.find_library('procstat', required: true)
>> +kvm = cc.find_library('kvm', required: true)
>> +bsd_user_ss.add(elf, procstat, kvm)
>
> What are these for?  Particularly kvm?
>
>
> r~

It's need to link with `libprocstat`, which is need for the 
`filestat` struct definition, and it's `proc_*` functions used
is `get_filename_from_fd` function, however the function is declared
static, which emits an `unused function warning`, but compiles
successfully.

The linker errors only when the `get_filename_from_fd` is used in
`freebsd_exec_common` function.

--
Karim Taha
diff mbox series

Patch

diff --git a/bsd-user/bsd-proc.h b/bsd-user/bsd-proc.h
index a1061bffb8..048773a75d 100644
--- a/bsd-user/bsd-proc.h
+++ b/bsd-user/bsd-proc.h
@@ -22,6 +22,10 @@ 
 
 #include <sys/resource.h>
 
+#include "qemu-bsd.h"
+#include "gdbstub/syscalls.h"
+#include "qemu/plugin.h"
+
 /* exit(2) */
 static inline abi_long do_bsd_exit(void *cpu_env, abi_long arg1)
 {
diff --git a/bsd-user/meson.build b/bsd-user/meson.build
index 5243122fc5..b97fce1472 100644
--- a/bsd-user/meson.build
+++ b/bsd-user/meson.build
@@ -7,6 +7,7 @@  bsd_user_ss = ss.source_set()
 common_user_inc += include_directories('include')
 
 bsd_user_ss.add(files(
+  'bsd-proc.c',
   'bsdload.c',
   'elfload.c',
   'main.c',
@@ -16,6 +17,11 @@  bsd_user_ss.add(files(
   'uaccess.c',
 ))
 
+elf = cc.find_library('elf', required: true)
+procstat = cc.find_library('procstat', required: true)
+kvm = cc.find_library('kvm', required: true)
+bsd_user_ss.add(elf, procstat, kvm)
+
 # Pull in the OS-specific build glue, if any
 subdir(targetos)