This commit is contained in:
parent
7173c05a22
commit
8c831a6906
@ -10,7 +10,7 @@ int main()
|
||||
printf("Hello world!\n");
|
||||
|
||||
mkdir("/dev", 0755);
|
||||
if (syscall(SYS_mknod, "/dev/console", 0666, makedev(1, 0)) < 0)
|
||||
if (mknod("/dev/console", 0666, makedev(1, 0)) < 0)
|
||||
{
|
||||
perror("mknod");
|
||||
return 1;
|
||||
@ -19,6 +19,6 @@ int main()
|
||||
const char* str = "Hello from /dev!";
|
||||
|
||||
FILE* f = fopen("/dev/console", "r+");
|
||||
fwrite(str, 1, strlen(str), f);
|
||||
if (f) fwrite(str, 1, strlen(str), f);
|
||||
if (f) fclose(f);
|
||||
}
|
||||
|
@ -14,6 +14,9 @@ extern "C"
|
||||
/* Create a directory. */
|
||||
int mkdir(const char* path, mode_t mode);
|
||||
|
||||
/* Create a special file. */
|
||||
int mknod(const char* path, mode_t mode, dev_t dev);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -10,4 +10,10 @@ extern "C"
|
||||
long rc = syscall(SYS_mkdir, path, mode);
|
||||
__errno_return(rc, int);
|
||||
}
|
||||
|
||||
int mknod(const char* path, mode_t mode, dev_t dev)
|
||||
{
|
||||
long rc = syscall(SYS_mknod, path, mode, dev);
|
||||
__errno_return(rc, int);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user