Skip to content

Commit

Permalink
Merge pull request #219 from nanovms/std-fstat
Browse files Browse the repository at this point in the history
handle fstat for stdin and stderr, stage make rule for use with nvm
  • Loading branch information
wjhun committed Nov 23, 2018
2 parents cce3ed5 + 49e6faf commit cf04953
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ image: mkfs boot stage3 target
@ mkdir -p $(dir $(IMAGE))
$(Q) $(MKFS) $(FS) < examples/$(TARGET).manifest && cat $(BOOTIMG) $(FS) > $(IMAGE)

stage: image
- mkdir .staging
- cp -a output/boot/boot.img .staging/boot.img
- cp -a output/stage3/stage3.img .staging/stage3.img

contgen: $(CONTGEN)

mkfs: mkfs-build
Expand Down
1 change: 1 addition & 0 deletions src/runtime/table.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ static inline key position(int buckets, key x)
void *table_find (table z, void *c)
{
table t = valueof(z);
assert(t);
key k = t->key_function(c);
for (entry i = t->entries[position(t->buckets, k)]; i; i = i->next){
if ((i->k == k) && t->equals_function(i->c, c))
Expand Down
6 changes: 3 additions & 3 deletions src/unix/syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ char *syscall_name(int x)
if (syscall_codes[i].c == x)
return syscall_codes[i].n;
}
return ("invalidine syscall");
return ("invalid syscall");
}

sysreturn read(int fd, u8 *dest, bytes length)
Expand Down Expand Up @@ -647,7 +647,6 @@ sysreturn openat(int dirfd, char *name, int flags, int mode)

static void fill_stat(tuple n, struct stat *s)
{
zero(s, sizeof(struct stat));
s->st_dev = 0;
s->st_ino = u64_from_pointer(n);
if (table_find(n, sym(children))) {
Expand All @@ -669,8 +668,9 @@ static sysreturn fstat(int fd, struct stat *s)
{
thread_log(current, "fd %d, stat %p\n", fd, s);
file f = resolve_fd(current->p, fd);
zero(s, sizeof(struct stat));
// take this from tuple space
if (fd == 1) {
if (fd == 0 || fd == 1 || fd == 2) {
s->st_mode = S_IFIFO;
return 0;
}
Expand Down

0 comments on commit cf04953

Please sign in to comment.