ioctl begins to work

This commit is contained in:
Ciro Santilli
2017-06-11 22:33:01 +01:00
parent bf538cd3a6
commit 025ba63a57
4 changed files with 38 additions and 2 deletions

View File

@@ -0,0 +1,11 @@
/* Replacement init example for when we feel like running
* a single non-interactive single executable Linux distro. */
#include <stdio.h>
#include <unistd.h>
int main(void) {
puts("hello world");
while (1)
sleep(0xFFFFFFFF);
}

View File

@@ -1,4 +1,5 @@
#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
@@ -6,7 +7,8 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include "../ioctl.h"
int main(int argc, char **argv)
{
@@ -21,7 +23,7 @@ int main(int argc, char **argv)
perror("open");
return EXIT_FAILURE;
}
ret = ioctl(fd, strtoul(argv[2], NULL, 10), argv[3]);
ret = ioctl(fd, IOCTL0, argv[3]);
if (ret == -1) {
perror("ioctl");
return EXIT_FAILURE;