Skip to content

Commit d7810d4

Browse files
committed
Add stat() for socket.
1 parent 18e10df commit d7810d4

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/fs/socket.c

+23
Original file line numberDiff line numberDiff line change
@@ -463,13 +463,36 @@ static size_t socket_write(struct file *f, const char *buf, size_t count)
463463
return socket_sendto(socket_file, buf, count, 0, NULL, 0);
464464
}
465465

466+
static int socket_stat(struct file *f, struct newstat *buf)
467+
{
468+
INIT_STRUCT_NEWSTAT_PADDING(buf);
469+
buf->st_dev = 0;
470+
buf->st_ino = 0;
471+
buf->st_mode = S_IFSOCK + 0644;
472+
buf->st_nlink = 1;
473+
buf->st_uid = 0;
474+
buf->st_gid = 0;
475+
buf->st_rdev = 0;
476+
buf->st_size = 0;
477+
buf->st_blksize = PAGE_SIZE;
478+
buf->st_blocks = 0;
479+
buf->st_atime = 0;
480+
buf->st_atime_nsec = 0;
481+
buf->st_mtime = 0;
482+
buf->st_mtime_nsec = 0;
483+
buf->st_ctime = 0;
484+
buf->st_ctime_nsec = 0;
485+
return 0;
486+
}
487+
466488
struct file_ops socket_ops =
467489
{
468490
.get_poll_status = socket_get_poll_status,
469491
.get_poll_handle = socket_get_poll_handle,
470492
.close = socket_close,
471493
.read = socket_read,
472494
.write = socket_write,
495+
.stat = socket_stat,
473496
};
474497

475498
static HANDLE init_socket_event(int sock)

0 commit comments

Comments
 (0)