/usr/include/machine/procctl.h is missing

I'm trying to use #include <sys/procctl.h>. But this header includes machine/procctl.h and that header is not present on my FreeBSD 12.3 system. I'm fairly certain that I didn't delete that file. How am I meant to get the machine/procctl.h file?
 

SirDice

Administrator
Staff member
Administrator
Moderator
File doesn't contain much, here is my copy:
Code:
/*-
 * This file is in the public domain.
 */
/* $FreeBSD$ */

#include <x86/procctl.h>
 
OP
rwmj
I don't have /usr/include/x86/procctl.h either.

pkg-provides suggests installing amd64-freebsd-sysroot, which I did, but that seems to only provide a cross-compiler file (usr/local/freebsd-sysroot/amd64/usr/include/machine/procctl.h etc)
 

SirDice

Administrator
Staff member
Administrator
Moderator
These files are part of the base OS, there are no packages for it.
 
You should be using what man page says, sys/procctl.h and not care about much else. I did a quick test program on 12.3:
Code:
#include <stdio.h>
#include <sys/procctl.h>
#include <unistd.h>

int main() {
        pid_t pid = getpid();

        int data = PROC_ASLR_FORCE_ENABLE;

        if ((procctl(P_PID, pid, PROC_ASLR_CTL, &data)) == -1) {
                perror("procctl");
                return 1;
        }
        return 0;
}
and it is working as expected.
However I do have /usr/include/machine/procctl.h. Depending on your installation it comes either from base.txz or from git installation. (edit: so as SirDice pointed out, it's part of the base).
 
Top