Friday, July 07, 2017

Re: A question of lock usage in OpenBSD kernel code

Hi Ingo,

Thank you for your reply - I've answered inline, below.

> On Jul 5, 2017, at 10:14 AM, Ingo Schwarze <schwarze@usta.de> wrote:
>
> The OpenBSD way is to write userland network daemons in C, not in C++.

Ok, thank you for clarifying that for me. I will proceed with development in C. As an aside - do OpenBSD developers track with the latest standard (C11), or is another standard preferred ?

>> I was thinking the best way to get started would be to spend two
>> to three months reading
>
> No. Certainly not. By all means, do read code, that is very
> important, but do it in parallel to getting hands-on experience by
> fixing bugs (and maybe implementing very simple features, which is
> *much* harder, in particular because new features are often rejected
> - it is not easy for beginners to figure out which new feature will
> be considered useful and which won't). Also, don't stop reading
> code after a few months; never stop doing that, at least not before
> you die.

Ok, that's a good point. I will read and practice by coding at the same time. In regards to either fixing small bugs and/or implementing new features, I must confess that while I am a software developer and also make use of OpenBSD in a sysadmin context, I have never prepared a patch and submitted it to OpenBSD.

I understand that is probably considered rather basic in the context of committing to OpenBSD, but I truthfully have no experience with it (except that I do read patches as they are submitted on the ports mailing list as well as for the kernel proper).

Is there a blog or sample mailing list thread I can reference to learn how to do this the proper way ? I don't expect to being sending patches immediately, but I would enjoy doing so as my reading and practicing progress.

> Such a manpage definitely doesn't exist, or i would have heard about it.
>
> If best practice recommendations exist with respect to a specific
> function, they are often explained in the manual page of that
> function. For example, i added a notice to prefer getline(3) to
> the top of the fgetln(3) manual just a few days ago.
>
> Such recommendations are sometimes placed at the top of the
> DESCRIPTION, sometimes in EXAMPLES or CAVEATS, and may also
> appear in other places. Sometimes, they are missing completely.
> For example, to my surprise, strcpy(3) only mentions strlcpy(3)
> below SEE ALSO.

Ok. I had something like style(9) (https://man.openbsd.org/style.9) in mind, but of course: 1) It is the kernel style guide, not user land 2) It doesn't offer a lot of "prefer this" text (not that it should, of course, since it's more about style).

That said it was worth reading and there are some things that I think apply regardless of where the code is. I also realized I forgot about the papers and presentations section of the website (https://www.openbsd.org/events.html), which has numerous coverage of pledge(2) and libtls, for instance.

>> Separate from the possible man page, are there any relatively
>> up-to-date examples that developers have been using to learn best
>> practices for writing software for OpenBSD?
>
> No. Developers are learning by doing, and by advice from fellow
> developers which they receive when posting their patches for review.

Ok, good to know.

Thanks again for your input,

- J

No comments:

Post a Comment