Compare commits

..

No commits in common. "6d821d2638398cff1a02abf353a50f7022eb4fda" and "e1e86ab889615e742feb89705cc3c7346ab3ac7f" have entirely different histories.

7 changed files with 9 additions and 48 deletions

View File

@ -3,7 +3,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <unistd.h>
@ -138,21 +137,13 @@ int main()
return 1;
}
fprintf(new_stderr, "Bye!\n\n");
fprintf(new_stderr, "Bye!\n");
fclose(new_stderr);
const char* pathname = "/etc";
execv("/bin/sym", NULL);
printf("Creating directory %s\n", pathname);
if (mkdir(pathname, 0) < 0)
{
perror("mkdir");
return 1;
}
printf("Success!!");
perror("execv"); // If we're here, execv failed
return 1;
}

View File

@ -17,7 +17,6 @@
#define SYS_fcntl 13
#define SYS_mprotect 14
#define SYS_clock 15
#define SYS_mkdir 17
#ifndef __want_syscalls
#ifdef __cplusplus

View File

@ -1,18 +0,0 @@
#ifndef _SYS_STAT_H
#define _SYS_STAT_H
#include <sys/types.h>
#ifdef __cplusplus
extern "C"
{
#endif
/* Creates a new directory at the path pathname. FIXME: For now, mode is ignored. */
int mkdir(const char* pathname, mode_t mode);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -13,7 +13,4 @@ typedef long int ssize_t;
/* The type of an offset into a file. */
typedef long int off_t;
/* The type of a file's mode. */
typedef unsigned short mode_t;
#endif

View File

@ -1,6 +1,5 @@
#include <fcntl.h>
#include <stdarg.h>
#include <stdint.h>
#include <sys/syscall.h>
#include <unistd.h>
@ -15,7 +14,12 @@ extern "C"
{
va_list ap;
va_start(ap, cmd);
long result = syscall(SYS_fcntl, fd, cmd, va_arg(ap, uintptr_t));
long result;
switch (cmd)
{
case F_DUPFD: result = syscall(SYS_fcntl, fd, cmd, va_arg(ap, int)); break;
default: result = syscall(SYS_fcntl, fd, cmd, 0); break;
}
va_end(ap);
return (int)result;
}

View File

@ -1,11 +0,0 @@
#include <sys/stat.h>
#include <sys/syscall.h>
#include <unistd.h>
extern "C"
{
int mkdir(const char* pathname, mode_t)
{
return (int)syscall(SYS_mkdir, pathname);
}
}

View File

@ -38,7 +38,6 @@ extern "C"
case SYS_exit:
case SYS_close:
case SYS_exec:
case SYS_mkdir:
case SYS_sleep: result = __luna_syscall1(number, va_arg(ap, arg)); break;
case SYS_munmap:
case SYS_open: {