Add test for creating a new file and add openc macro to use openat with the mode option
This commit is contained in:
@@ -28,9 +28,14 @@ int main() {
|
||||
// Test the read syscall
|
||||
#define INPUT_BUFFER_LEN 4096
|
||||
char input_buffer[INPUT_BUFFER_LEN] = {0};
|
||||
int32_t fout = openc("outfile", O_RDWR | O_CREAT | O_TRUNC, 0664);
|
||||
|
||||
write(STDOUT, "Enter some text:", 16);
|
||||
intptr_t n_read = read(STDIN, input_buffer, INPUT_BUFFER_LEN);
|
||||
write(STDOUT, input_buffer, n_read);
|
||||
if(fout > 0) {
|
||||
write(fout, input_buffer, n_read);
|
||||
}
|
||||
|
||||
// Test the open syscall
|
||||
int32_t file = open("/proc/version", O_RDONLY);
|
||||
|
||||
Reference in New Issue
Block a user