SRC Contributions: Advice and Objections

From: Jake Freeland <jake_at_technologyfriends.net>
Date: Mon, 29 Aug 2022 20:17:51 UTC
Hi there,

I've been hard at work over the last few months contributing to FreeBSD
through
the Google Summer of Code program and learning about the operating system.
Now that I am almost finished with porting Intel's igt-gpu-tools to
FreeBSD, I am
thinking about other potential SRC contributions that I can get started on.

I ran into a few OS-related problems during my project that I would like to
fix.
I thought I would share those issues here for advice and potential
objections.

* Implementing signalfd:
https://man7.org/linux/man-pages/man2/signalfd.2.html
This is a huge one. I needed to comment a lot of important code inside
of igt-gpu-tools to compensate for signalfd's absence. I am reading The
Design and Implementation of the FreeBSD Operating System by McKusick,
Neville-Neil, and Watson (excellent read by the way) to get a comprehensive
grasp on how FreeBSD handles signals and file descriptors internally.
I plan to finish the book and get started on this first.

* Implementing timerfd:
https://man7.org/linux/man-pages/man2/timerfd_gettime.2.html
I am unsure whether it would be beneficial to upstream POSIX timer
patches for igt-gpu-tools or to implement timerfd for FreeBSD. I am
erring on the side of implementing timerfd if other applications need
to use it in the future.

* Implementing userfaultfd:
https://man7.org/linux/man-pages/man2/userfaultfd.2.html
Page fault handling and processing from the userspace.

* Adding %m format specifier to scanf:
The %m format specifier is a POSIX extension to the ISO C standard that can
precede
%c, %s, and %[. The %m allocates a memory buffer to hold the string
including a
terminating null character.

* Adding the gettid() funtion:
https://man7.org/linux/man-pages/man2/gettid.2.html
This function grabs the thread identifier for the currently running process.
I am not yet informed about FreeBSD's thread scheduling so I don't know
if adding this function is even necessary.

* Adding ETIME errno:
I am not sure how necessary this one is because ETIMEDOUT exists, but I
understand the distinction between the two. I would think that ETIME
would already be present if it were necessary.

Any input would be appreciated.

Thank you,
Jake Freeland