Skip to content

Instantly share code, notes, and snippets.

@bnoordhuis
Created August 31, 2012 22:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bnoordhuis/c909c3c998707b3c7409 to your computer and use it in GitHub Desktop.
Save bnoordhuis/c909c3c998707b3c7409 to your computer and use it in GitHub Desktop.
linux swapon command
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <syscall.h>
int main(int argc, char **argv)
{
(void) argc;
if (syscall(SYS_swapon, argv[1], 0)) {
perror("swapon");
exit(1);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment