
Previously, VFS would use various subsets of a number of fproc structure fields to store state when the process is blocked (suspended) for various reasons. As a result, there was a fair amount of abuse of fields, hidden state, and confusion as to which fields were used with which suspension states. Instead, the suspension state is now split into per-state structures, which are then stored in a union. Each of the union's structures should be accessed only right before, during, and right after the fp_blocked_on field is set to the corresponding blocking type. As a result, it is now very clear which fields are in use at which times, and we even save a bit of memory as a side effect. Change-Id: I5c24e353b6cb0c32eb41c70f89c5cfb23f6c93df
23 lines
454 B
C
23 lines
454 B
C
#include <sys/cdefs.h>
|
|
#include <lib.h>
|
|
#include "namespace.h"
|
|
|
|
#include <string.h>
|
|
#include <unistd.h>
|
|
|
|
#ifdef __weak_alias
|
|
__weak_alias(read, _read)
|
|
#endif
|
|
|
|
ssize_t read(int fd, void *buffer, size_t nbytes)
|
|
{
|
|
message m;
|
|
|
|
memset(&m, 0, sizeof(m));
|
|
m.m_lc_vfs_readwrite.fd = fd;
|
|
m.m_lc_vfs_readwrite.len = nbytes;
|
|
m.m_lc_vfs_readwrite.buf = (vir_bytes)buffer;
|
|
m.m_lc_vfs_readwrite.cum_io = 0;
|
|
return(_syscall(VFS_PROC_NR, VFS_READ, &m));
|
|
}
|