Re: [dev] pledge(2) patches

From: Ben Woolley <tautolog_AT_gmail.com>
Date: Sun, 5 Jun 2016 16:44:53 -0700

> On Jun 5, 2016, at 1:31 PM, FRIGN <dev_AT_frign.de> wrote:
>
> On Sun, 5 Jun 2016 13:11:15 -0700
> Ben Woolley <tautolog_AT_gmail.com> wrote:
>
> Hey Ben,
>
>> Regarding #2, the usage stats of openbsd should be joined with the
>> usage stats of st. I don't know the answer, but I am guessing not
>> insignificant, especially since an openbsd user was driven to do it
>> already. And it might increase now that it has pledge support.
>> Terminals accept arbitrary input, so pledge support could be a very
>> desirable and well-suited feature.
>
> this is a very good point I didn't think of beforehand. In this
> regard, we might want to think about an option, however, why not
> do it like this?
>
> #ifndef __OpenBSD__
> int pledge(const char *promises, const char *paths[]) { return 0; }
> #endif
>
> This way, we can call it easily in the code without troubles.
> I admittedly am a huge supporter of pledge() and would be happy
> to see it included in suckless tools. However, there always will
> remain a bad aftertaste given it's an OS-dependent solution.
> However, to be fair, I think OpenBSD is the best OS out there.
>

What I often find myself doing in cases like this is create a hook function that is named for the stage or event, and then putting the OS-specific stuff in that. However, for smaller programs, that can be more obscuring than descriptive, especially when there isn't already a need for a bunch of hooks in one place where people know where to look for OS-specific stuff.

But then, isn't that what config.h can do? Try it in config.h and see how you feel. A lot of OS-specific features are enabled from configuration in other software.

> Cheers
>
> FRIGN
>
> --
> FRIGN <dev_AT_frign.de>
>
Received on Mon Jun 06 2016 - 01:44:53 CEST

This archive was generated by hypermail 2.3.0 : Mon Jun 06 2016 - 01:48:10 CEST