Date: Tue, 10 Jan 2023 17:40:14 -0600 From: Jake Freeland <jake@technologyfriends.net> To: Mateusz Guzik <mjguzik@gmail.com> Cc: freebsd-hackers@freebsd.org Subject: Re: Syscalls: eventfd and timerfd Message-ID: <CAOgZAGa3wY6Z4ChqLs_SZkGi%2BzF=rgZXkZGM=-C5_poDW-UkuQ@mail.gmail.com> In-Reply-To: <CAGudoHHd%2BqixeXW_V3f4pXWG8-Bi6eAbUHBGY6033W8P-JBivA@mail.gmail.com> References: <CAOgZAGbK5H=JtxY7MZKyyXa=i=CXbYtV4tCOvg6N-CRYjqJ4fQ@mail.gmail.com> <CAGudoHHd%2BqixeXW_V3f4pXWG8-Bi6eAbUHBGY6033W8P-JBivA@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--00000000000077e4cf05f1f16840 Content-Type: text/plain; charset="UTF-8" On Tue, Jan 10, 2023 at 5:30 PM Mateusz Guzik <mjguzik@gmail.com> wrote: > It is added with a non-standard entry point. > > If you git log -p sys/kern/sys_eventfd.c you will see: > Thanks. This pointed me in the right direction. That commit contains almost everything I need to continue. Jake Freeland > > commit 7a202823aa54ba18c485bdbcf355269bcfee1ab9 > Author: Konstantin Belousov <kib@FreeBSD.org> > Date: Wed Dec 23 16:14:04 2020 +0200 > > Expose eventfd in the native API/ABI using a new __specialfd syscall > > then if you git grep __specialfd: > lib/libc/gen/eventfd.c: return (__sys___specialfd(SPECIALFD_EVENTFD, > &args, sizeof(args))); > lib/libc/include/libc_private.h:int __sys___specialfd(int, > const void *, __size_t); > sys/compat/freebsd32/freebsd32_syscall.h:#define > FREEBSD32_SYS___specialfd 577 > sys/compat/freebsd32/freebsd32_syscalls.c: "__specialfd", > /* 577 = __specialfd */ > sys/compat/freebsd32/freebsd32_sysent.c: { .sy_narg = > AS(__specialfd_args), .sy_call = (sy_call_t *)sys___specialfd, > .sy_auevent = AUE_SPECIALFD, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = > SY_THR_STATIC }, /* 577 = __specialfd */ > sys/compat/freebsd32/freebsd32_systrace_args.c: /* __specialfd */ > sys/compat/freebsd32/freebsd32_systrace_args.c: struct > __specialfd_args *p = params; > sys/compat/freebsd32/freebsd32_systrace_args.c: /* __specialfd */ > sys/compat/freebsd32/freebsd32_systrace_args.c: /* __specialfd */ > sys/kern/init_sysent.c: { .sy_narg = AS(__specialfd_args), .sy_call = > (sy_call_t *)sys___specialfd, .sy_auevent = AUE_SPECIALFD, .sy_flags = > SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 577 = __specialfd > */ > sys/kern/sys_generic.c:sys___specialfd(struct thread *td, struct > __specialfd_args *args) > sys/kern/syscalls.c: "__specialfd", /* 577 = > __specialfd */ > sys/kern/syscalls.master: int __specialfd( > sys/kern/systrace_args.c: /* __specialfd */ > sys/kern/systrace_args.c: struct __specialfd_args *p = > params; > sys/kern/systrace_args.c: /* __specialfd */ > sys/kern/systrace_args.c: /* __specialfd */ > sys/sys/syscall.h:#define SYS___specialfd 577 > sys/sys/syscall.mk: __specialfd.o \ > sys/sys/sysproto.h:struct __specialfd_args { > sys/sys/sysproto.h:int sys___specialfd(struct thread *, struct > __specialfd_args *); > sys/sys/sysproto.h:#define SYS_AUE___specialfd AUE_SPECIALFD > > On 1/11/23, Jake Freeland <jake@technologyfriends.net> wrote: > > Hi there, > > > > I am currently working on moving the linux_compat implementation of > > timerfd (in sys/compat/linux/linux_event.c) into its own FreeBSD syscall > > similar to what was done for eventfd. This is my first time implementing > > a syscall, so I have been following the eventfd implementation as a > > reference. I noticed that the eventfd syscall entries are absent from > > sys/kern/syscalls.master and I am not sure why. Was eventfd never > > formally added as a syscall entry or am I missing something? I was > > planning on adding timerfd entries to syscalls.master, but now I am > > unsure how to proceed. > > > > I apologize for my ignorance. This process is new to me. > > > > Thank you, > > Jake Freeland > > > > > -- > Mateusz Guzik <mjguzik gmail.com> > --00000000000077e4cf05f1f16840 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div dir=3D"ltr">On Tue, Jan 10, 2023 at 5:30 PM Mateusz G= uzik <<a href=3D"mailto:mjguzik@gmail.com">mjguzik@gmail.com</a>> wro= te:<br></div><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" s= tyle=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);pad= ding-left:1ex">It is added with a non-standard entry point.<br> <br> If you git log -p sys/kern/sys_eventfd.c you will see:<br></blockquote><div= ><br></div><div>Thanks. This pointed me in the right=C2=A0direction. That c= ommit contains</div><div>almost everything I need to continue.</div><div><b= r></div><div>Jake Freeland</div><div>=C2=A0</div><blockquote class=3D"gmail= _quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204= ,204);padding-left:1ex"> <br> commit 7a202823aa54ba18c485bdbcf355269bcfee1ab9<br> Author: Konstantin Belousov <kib@FreeBSD.org><br> Date:=C2=A0 =C2=A0Wed Dec 23 16:14:04 2020 +0200<br> <br> =C2=A0 =C2=A0 Expose eventfd in the native API/ABI using a new __specialfd = syscall<br> <br> then if you git grep __specialfd:<br> lib/libc/gen/eventfd.c: return (__sys___specialfd(SPECIALFD_EVENTFD,<br> &args, sizeof(args)));<br> lib/libc/include/libc_private.h:int=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0__sys___specialfd(int,<br> const void *, __size_t);<br> sys/compat/freebsd32/freebsd32_syscall.h:#define<br> FREEBSD32_SYS___specialfd=C2=A0 =C2=A0 =C2=A0 =C2=A0577<br> sys/compat/freebsd32/freebsd32_syscalls.c:=C2=A0 =C2=A0 =C2=A0 "__spec= ialfd",<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* 577 =3D __specialfd */<br> sys/compat/freebsd32/freebsd32_sysent.c:=C2=A0 =C2=A0 =C2=A0 =C2=A0 { .sy_n= arg =3D<br> AS(__specialfd_args), .sy_call =3D (sy_call_t *)sys___specialfd,<br> .sy_auevent =3D AUE_SPECIALFD, .sy_flags =3D SYF_CAPENABLED, .sy_thrcnt =3D= <br> SY_THR_STATIC },=C2=A0 =C2=A0 /* 577 =3D __specialfd */<br> sys/compat/freebsd32/freebsd32_systrace_args.c: /* __specialfd */<br> sys/compat/freebsd32/freebsd32_systrace_args.c:=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0struct<br> __specialfd_args *p =3D params;<br> sys/compat/freebsd32/freebsd32_systrace_args.c: /* __specialfd */<br> sys/compat/freebsd32/freebsd32_systrace_args.c: /* __specialfd */<br> sys/kern/init_sysent.c: { .sy_narg =3D AS(__specialfd_args), .sy_call =3D<b= r> (sy_call_t *)sys___specialfd, .sy_auevent =3D AUE_SPECIALFD, .sy_flags =3D<= br> SYF_CAPENABLED, .sy_thrcnt =3D SY_THR_STATIC },=C2=A0 =C2=A0 /* 577 =3D __s= pecialfd<br> */<br> sys/kern/sys_generic.c:sys___specialfd(struct thread *td, struct<br> __specialfd_args *args)<br> sys/kern/syscalls.c:=C2=A0 =C2=A0 "__specialfd",=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* 577 =3D __specialfd */<br> sys/kern/syscalls.master:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0int __specialfd(<br> sys/kern/systrace_args.c:=C2=A0 =C2=A0 =C2=A0 =C2=A0/* __specialfd */<br> sys/kern/systrace_args.c:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0struct __specialfd_args *p =3D params;<br> sys/kern/systrace_args.c:=C2=A0 =C2=A0 =C2=A0 =C2=A0/* __specialfd */<br> sys/kern/systrace_args.c:=C2=A0 =C2=A0 =C2=A0 =C2=A0/* __specialfd */<br> sys/sys/syscall.h:#define=C2=A0 =C2=A0 =C2=A0 =C2=A0SYS___specialfd 577<br> sys/sys/<a href=3D"http://syscall.mk" rel=3D"noreferrer" target=3D"_blank">= syscall.mk</a>:=C2=A0 =C2=A0 =C2=A0__specialfd.o \<br> sys/sys/sysproto.h:struct __specialfd_args {<br> sys/sys/sysproto.h:int=C2=A0 sys___specialfd(struct thread *, struct<br> __specialfd_args *);<br> sys/sys/sysproto.h:#define=C2=A0 =C2=A0 =C2=A0 SYS_AUE___specialfd=C2=A0 = =C2=A0 =C2=A0AUE_SPECIALFD<br> <br> On 1/11/23, Jake Freeland <<a href=3D"mailto:jake@technologyfriends.net"= target=3D"_blank">jake@technologyfriends.net</a>> wrote:<br> > Hi there,<br> ><br> > I am currently working on moving the linux_compat implementation of<br= > > timerfd (in sys/compat/linux/linux_event.c) into its own FreeBSD sysca= ll<br> > similar to what was done for eventfd. This is my first time implementi= ng<br> > a syscall, so I have been following the eventfd implementation as a<br= > > reference. I noticed that the eventfd syscall entries are absent from<= br> > sys/kern/syscalls.master and I am not sure why. Was eventfd never<br> > formally added as a syscall entry or am I missing something? I was<br> > planning on adding timerfd entries to syscalls.master, but now I am<br= > > unsure how to proceed.<br> ><br> > I apologize for my ignorance. This process is new to me.<br> ><br> > Thank you,<br> > Jake Freeland<br> ><br> <br> <br> -- <br> Mateusz Guzik <mjguzik <a href=3D"http://gmail.com" rel=3D"noreferrer" t= arget=3D"_blank">gmail.com</a>><br> </blockquote></div></div> --00000000000077e4cf05f1f16840--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOgZAGa3wY6Z4ChqLs_SZkGi%2BzF=rgZXkZGM=-C5_poDW-UkuQ>