You use the mount(2)
system call. From the manpage:
SYNOPSIS
#include <sys/mount.h> int mount(const char *source, const char *target, const char *filesystemtype, unsigned long mountflags, const void *data);
So, in your C code, that'd look something like:
#include <sys/mount.h>
/* ... */
void mount_sys() {
if (0 != mount("none", "/sys", "sysfs", 0, "")) {
/* handle error */
}
}
(That last empty string is where you'd pass mount options, but AFAIK sysfs doesn't take any.)