Andy's formatting changes.
This commit is contained in:
parent
5ae6f98dea
commit
42fbd9aced
@ -300,9 +300,9 @@ dev_t device; /* device whose blocks are to be purged */
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*==========================================================================*
|
/*===========================================================================*
|
||||||
* flushall *
|
* flushall *
|
||||||
*==========================================================================*/
|
*===========================================================================*/
|
||||||
PUBLIC void flushall(dev)
|
PUBLIC void flushall(dev)
|
||||||
dev_t dev; /* device to flush */
|
dev_t dev; /* device to flush */
|
||||||
{
|
{
|
||||||
@ -404,7 +404,7 @@ int rw_flag; /* READING or WRITING */
|
|||||||
bufqsize--;
|
bufqsize--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(rw_flag == WRITING && i == 0) {
|
if (rw_flag == WRITING && i == 0) {
|
||||||
/* We're not making progress, this means we might keep
|
/* We're not making progress, this means we might keep
|
||||||
* looping. Buffers remain dirty if un-written. Buffers are
|
* looping. Buffers remain dirty if un-written. Buffers are
|
||||||
* lost if invalidate()d or LRU-removed while dirty. This
|
* lost if invalidate()d or LRU-removed while dirty. This
|
||||||
|
@ -36,11 +36,11 @@ PUBLIC int cdprobe(void)
|
|||||||
/* Open device readonly. (This fails if the device
|
/* Open device readonly. (This fails if the device
|
||||||
* is also writable, which a CD isn't.)
|
* is also writable, which a CD isn't.)
|
||||||
*/
|
*/
|
||||||
if((r = dev_open(dev, FS_PROC_NR, RO_BIT)) != OK) {
|
if ((r = dev_open(dev, FS_PROC_NR, RO_BIT)) != OK) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((r = dev_io(DEV_READ, dev, FS_PROC_NR, pvd,
|
if ((r = dev_io(DEV_READ, dev, FS_PROC_NR, pvd,
|
||||||
16*CD_SECTOR, sizeof(pvd), 0)) != sizeof(pvd)) {
|
16*CD_SECTOR, sizeof(pvd), 0)) != sizeof(pvd)) {
|
||||||
dev_close(dev);
|
dev_close(dev);
|
||||||
continue;
|
continue;
|
||||||
@ -48,7 +48,7 @@ PUBLIC int cdprobe(void)
|
|||||||
dev_close(dev);
|
dev_close(dev);
|
||||||
|
|
||||||
/* Check PVD ID. */
|
/* Check PVD ID. */
|
||||||
if(pvd[0] != 1 || pvd[1] != 'C' || pvd[2] != 'D' ||
|
if (pvd[0] != 1 || pvd[1] != 'C' || pvd[2] != 'D' ||
|
||||||
pvd[3] != '0' || pvd[4] != '0' || pvd[5] != '1' || pvd[6] != 1 ||
|
pvd[3] != '0' || pvd[4] != '0' || pvd[5] != '1' || pvd[6] != 1 ||
|
||||||
strncmp(pvd + 40, "MINIX", 5)) {
|
strncmp(pvd + 40, "MINIX", 5)) {
|
||||||
continue;
|
continue;
|
||||||
@ -57,18 +57,18 @@ PUBLIC int cdprobe(void)
|
|||||||
/* 3. Both c0dXp1 and p2 should have a superblock. */
|
/* 3. Both c0dXp1 and p2 should have a superblock. */
|
||||||
for(minor = minors[i]+2; minor <= minors[i]+3; minor++) {
|
for(minor = minors[i]+2; minor <= minors[i]+3; minor++) {
|
||||||
dev = (AT_MAJOR << MAJOR) | minor;
|
dev = (AT_MAJOR << MAJOR) | minor;
|
||||||
if((r = dev_open(dev, FS_PROC_NR, R_BIT)) != OK) {
|
if ((r = dev_open(dev, FS_PROC_NR, R_BIT)) != OK) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
probe_super.s_dev = dev;
|
probe_super.s_dev = dev;
|
||||||
r = read_super(&probe_super);
|
r = read_super(&probe_super);
|
||||||
dev_close(dev);
|
dev_close(dev);
|
||||||
if(r != OK) {
|
if (r != OK) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(minor > minors[i]+3) {
|
if (minor > minors[i]+3) {
|
||||||
/* Success? Then set dev to p1. */
|
/* Success? Then set dev to p1. */
|
||||||
dev = (AT_MAJOR << MAJOR) | (minors[i]+2);
|
dev = (AT_MAJOR << MAJOR) | (minors[i]+2);
|
||||||
found = 1;
|
found = 1;
|
||||||
@ -76,7 +76,7 @@ PUBLIC int cdprobe(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!found) return NO_DEV;
|
if (!found) return NO_DEV;
|
||||||
|
|
||||||
return dev;
|
return dev;
|
||||||
}
|
}
|
||||||
|
@ -70,16 +70,16 @@ PUBLIC void dev_status(message *m)
|
|||||||
int d, get_more = 1;
|
int d, get_more = 1;
|
||||||
|
|
||||||
for(d = 0; d < NR_DEVICES; d++)
|
for(d = 0; d < NR_DEVICES; d++)
|
||||||
if(dmap[d].dmap_driver == m->m_source)
|
if (dmap[d].dmap_driver == m->m_source)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if(d >= NR_DEVICES)
|
if (d >= NR_DEVICES)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
int r;
|
int r;
|
||||||
st.m_type = DEV_STATUS;
|
st.m_type = DEV_STATUS;
|
||||||
if((r=sendrec(m->m_source, &st)) != OK)
|
if ((r=sendrec(m->m_source, &st)) != OK)
|
||||||
panic(__FILE__,"couldn't sendrec for DEV_STATUS", r);
|
panic(__FILE__,"couldn't sendrec for DEV_STATUS", r);
|
||||||
|
|
||||||
switch(st.m_type) {
|
switch(st.m_type) {
|
||||||
@ -354,7 +354,7 @@ message *mess_ptr; /* pointer to message for task */
|
|||||||
/* Did the process we did the sendrec() for get a result? */
|
/* Did the process we did the sendrec() for get a result? */
|
||||||
if (mess_ptr->REP_PROC_NR == proc_nr) {
|
if (mess_ptr->REP_PROC_NR == proc_nr) {
|
||||||
break;
|
break;
|
||||||
} else if(mess_ptr->m_type == REVIVE) {
|
} else if (mess_ptr->m_type == REVIVE) {
|
||||||
/* Otherwise it should be a REVIVE. */
|
/* Otherwise it should be a REVIVE. */
|
||||||
revive(mess_ptr->REP_PROC_NR, mess_ptr->REP_STATUS);
|
revive(mess_ptr->REP_PROC_NR, mess_ptr->REP_STATUS);
|
||||||
} else {
|
} else {
|
||||||
|
@ -50,7 +50,7 @@ PRIVATE struct dmap init_dmap[] = {
|
|||||||
DT(0, no_dev, 0, NONE, DMAP_MUTABLE) /*13 = /dev/audio */
|
DT(0, no_dev, 0, NONE, DMAP_MUTABLE) /*13 = /dev/audio */
|
||||||
DT(0, no_dev, 0, NONE, DMAP_MUTABLE) /*14 = /dev/mixer */
|
DT(0, no_dev, 0, NONE, DMAP_MUTABLE) /*14 = /dev/mixer */
|
||||||
DT(1, gen_opcl, gen_io, LOG_PROC_NR, 0) /*15 = /dev/klog */
|
DT(1, gen_opcl, gen_io, LOG_PROC_NR, 0) /*15 = /dev/klog */
|
||||||
DT(0, no_dev, 0, NONE, DMAP_MUTABLE) /*16 = /dev/random */
|
DT(0, no_dev, 0, NONE, DMAP_MUTABLE) /*16 = /dev/random*/
|
||||||
DT(0, no_dev, 0, NONE, DMAP_MUTABLE) /*17 = /dev/cmos */
|
DT(0, no_dev, 0, NONE, DMAP_MUTABLE) /*17 = /dev/cmos */
|
||||||
#endif /* IBM_PC */
|
#endif /* IBM_PC */
|
||||||
};
|
};
|
||||||
|
@ -248,7 +248,7 @@ int optional;
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
if ((i = env_get_param(key, value, sizeof(value))) != OK) {
|
if ((i = env_get_param(key, value, sizeof(value))) != OK) {
|
||||||
if(!optional)
|
if (!optional)
|
||||||
printf("FS: Warning, couldn't get monitor param: %d\n", i);
|
printf("FS: Warning, couldn't get monitor param: %d\n", i);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -289,7 +289,7 @@ PRIVATE void load_ram(void)
|
|||||||
u32_t fsmax, probedev;
|
u32_t fsmax, probedev;
|
||||||
|
|
||||||
/* If we are running from CD, see if we can find it. */
|
/* If we are running from CD, see if we can find it. */
|
||||||
if(igetenv("cdproberoot", 1) && (probedev=cdprobe()) != NO_DEV) {
|
if (igetenv("cdproberoot", 1) && (probedev=cdprobe()) != NO_DEV) {
|
||||||
char devnum[10];
|
char devnum[10];
|
||||||
struct sysgetenv env;
|
struct sysgetenv env;
|
||||||
|
|
||||||
@ -371,7 +371,7 @@ PRIVATE void load_ram(void)
|
|||||||
/* RAM block size has to be a multiple of the root image block
|
/* RAM block size has to be a multiple of the root image block
|
||||||
* size to make copying easier.
|
* size to make copying easier.
|
||||||
*/
|
*/
|
||||||
if(block_size_image % block_size_ram) {
|
if (block_size_image % block_size_ram) {
|
||||||
printf("\nram block size: %d image block size: %d\n",
|
printf("\nram block size: %d image block size: %d\n",
|
||||||
block_size_ram, block_size_image);
|
block_size_ram, block_size_image);
|
||||||
panic(__FILE__, "ram disk block size must be a multiple of "
|
panic(__FILE__, "ram disk block size must be a multiple of "
|
||||||
@ -407,12 +407,12 @@ PRIVATE void load_ram(void)
|
|||||||
dev_close(image_dev);
|
dev_close(image_dev);
|
||||||
|
|
||||||
/* Resize the RAM disk root file system. */
|
/* Resize the RAM disk root file system. */
|
||||||
if(dev_io(DEV_READ, root_dev, FS_PROC_NR,
|
if (dev_io(DEV_READ, root_dev, FS_PROC_NR,
|
||||||
sbbuf, SUPER_BLOCK_BYTES, MIN_BLOCK_SIZE, 0) != MIN_BLOCK_SIZE) {
|
sbbuf, SUPER_BLOCK_BYTES, MIN_BLOCK_SIZE, 0) != MIN_BLOCK_SIZE) {
|
||||||
printf("WARNING: ramdisk read for resizing failed\n");
|
printf("WARNING: ramdisk read for resizing failed\n");
|
||||||
}
|
}
|
||||||
dsp = (struct super_block *) sbbuf;
|
dsp = (struct super_block *) sbbuf;
|
||||||
if(dsp->s_magic == SUPER_V3)
|
if (dsp->s_magic == SUPER_V3)
|
||||||
ramfs_block_size = dsp->s_block_size;
|
ramfs_block_size = dsp->s_block_size;
|
||||||
else
|
else
|
||||||
ramfs_block_size = STATIC_BLOCK_SIZE;
|
ramfs_block_size = STATIC_BLOCK_SIZE;
|
||||||
@ -420,7 +420,7 @@ PRIVATE void load_ram(void)
|
|||||||
|
|
||||||
dsp->s_nzones = conv2(sp->s_native, (u16_t) zones);
|
dsp->s_nzones = conv2(sp->s_native, (u16_t) zones);
|
||||||
dsp->s_zones = conv4(sp->s_native, zones);
|
dsp->s_zones = conv4(sp->s_native, zones);
|
||||||
if(dev_io(DEV_WRITE, root_dev, FS_PROC_NR,
|
if (dev_io(DEV_WRITE, root_dev, FS_PROC_NR,
|
||||||
sbbuf, SUPER_BLOCK_BYTES, MIN_BLOCK_SIZE, 0) != MIN_BLOCK_SIZE) {
|
sbbuf, SUPER_BLOCK_BYTES, MIN_BLOCK_SIZE, 0) != MIN_BLOCK_SIZE) {
|
||||||
printf("WARNING: ramdisk write for resizing failed\n");
|
printf("WARNING: ramdisk write for resizing failed\n");
|
||||||
}
|
}
|
||||||
|
@ -286,7 +286,7 @@ int flag; /* LOOK_UP, ENTER, DELETE or IS_EMPTY */
|
|||||||
/* Since directories don't have holes, 'b' cannot be NO_BLOCK. */
|
/* Since directories don't have holes, 'b' cannot be NO_BLOCK. */
|
||||||
bp = get_block(ldir_ptr->i_dev, b, NORMAL); /* get a dir block */
|
bp = get_block(ldir_ptr->i_dev, b, NORMAL); /* get a dir block */
|
||||||
|
|
||||||
if(bp == NO_BLOCK)
|
if (bp == NO_BLOCK)
|
||||||
panic(__FILE__,"get_block returned NO_BLOCK", NO_NUM);
|
panic(__FILE__,"get_block returned NO_BLOCK", NO_NUM);
|
||||||
|
|
||||||
/* Search a directory block. */
|
/* Search a directory block. */
|
||||||
|
@ -109,7 +109,7 @@ int notouch; /* check only */
|
|||||||
if (oflags & O_NONBLOCK) {
|
if (oflags & O_NONBLOCK) {
|
||||||
r = EAGAIN;
|
r = EAGAIN;
|
||||||
} else {
|
} else {
|
||||||
if(!notouch)
|
if (!notouch)
|
||||||
suspend(XPIPE); /* block reader */
|
suspend(XPIPE); /* block reader */
|
||||||
r = SUSPEND;
|
r = SUSPEND;
|
||||||
}
|
}
|
||||||
@ -123,7 +123,7 @@ int notouch; /* check only */
|
|||||||
/* Process is writing to a pipe. */
|
/* Process is writing to a pipe. */
|
||||||
if (find_filp(rip, R_BIT) == NIL_FILP) {
|
if (find_filp(rip, R_BIT) == NIL_FILP) {
|
||||||
/* Tell kernel to generate a SIGPIPE signal. */
|
/* Tell kernel to generate a SIGPIPE signal. */
|
||||||
if(!notouch)
|
if (!notouch)
|
||||||
sys_kill((int)(fp - fproc), SIGPIPE);
|
sys_kill((int)(fp - fproc), SIGPIPE);
|
||||||
return(EPIPE);
|
return(EPIPE);
|
||||||
}
|
}
|
||||||
@ -137,7 +137,7 @@ int notouch; /* check only */
|
|||||||
if ( (*canwrite = (PIPE_SIZE(rip->i_sp->s_block_size)
|
if ( (*canwrite = (PIPE_SIZE(rip->i_sp->s_block_size)
|
||||||
- position)) > 0) {
|
- position)) > 0) {
|
||||||
/* Do a partial write. Need to wakeup reader */
|
/* Do a partial write. Need to wakeup reader */
|
||||||
if(!notouch)
|
if (!notouch)
|
||||||
release(rip, READ, susp_count);
|
release(rip, READ, susp_count);
|
||||||
return(1);
|
return(1);
|
||||||
} else {
|
} else {
|
||||||
@ -154,7 +154,7 @@ int notouch; /* check only */
|
|||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!notouch)
|
if (!notouch)
|
||||||
suspend(XPIPE); /* stop writer -- pipe full */
|
suspend(XPIPE); /* stop writer -- pipe full */
|
||||||
return(SUSPEND);
|
return(SUSPEND);
|
||||||
}
|
}
|
||||||
@ -213,14 +213,14 @@ int count; /* max number of processes to release */
|
|||||||
/* Trying to perform the call also includes SELECTing on it with that
|
/* Trying to perform the call also includes SELECTing on it with that
|
||||||
* operation.
|
* operation.
|
||||||
*/
|
*/
|
||||||
if(call_nr == READ || call_nr == WRITE) {
|
if (call_nr == READ || call_nr == WRITE) {
|
||||||
int op;
|
int op;
|
||||||
if(call_nr == READ)
|
if (call_nr == READ)
|
||||||
op = SEL_RD;
|
op = SEL_RD;
|
||||||
else
|
else
|
||||||
op = SEL_WR;
|
op = SEL_WR;
|
||||||
for(f = &filp[0]; f < &filp[NR_FILPS]; f++) {
|
for(f = &filp[0]; f < &filp[NR_FILPS]; f++) {
|
||||||
if(f->filp_count < 1 || !(f->filp_pipe_select_ops & op) ||
|
if (f->filp_count < 1 || !(f->filp_pipe_select_ops & op) ||
|
||||||
f->filp_ino != ip)
|
f->filp_ino != ip)
|
||||||
continue;
|
continue;
|
||||||
select_callback(f, op);
|
select_callback(f, op);
|
||||||
@ -274,7 +274,7 @@ int returned; /* if hanging on task, how many bytes read */
|
|||||||
rfp->fp_suspended = NOT_SUSPENDED;
|
rfp->fp_suspended = NOT_SUSPENDED;
|
||||||
if (task == XPOPEN) /* process blocked in open or create */
|
if (task == XPOPEN) /* process blocked in open or create */
|
||||||
reply(proc_nr, rfp->fp_fd>>8);
|
reply(proc_nr, rfp->fp_fd>>8);
|
||||||
else if(task == XSELECT) {
|
else if (task == XSELECT) {
|
||||||
reply(proc_nr, returned);
|
reply(proc_nr, returned);
|
||||||
} else {
|
} else {
|
||||||
/* Revive a process suspended on TTY or other device. */
|
/* Revive a process suspended on TTY or other device. */
|
||||||
@ -349,24 +349,24 @@ PUBLIC int select_request_pipe(struct filp *f, int *ops, int block)
|
|||||||
{
|
{
|
||||||
int orig_ops, r = 0, err, canwrite;
|
int orig_ops, r = 0, err, canwrite;
|
||||||
orig_ops = *ops;
|
orig_ops = *ops;
|
||||||
if((*ops & SEL_RD)) {
|
if ((*ops & SEL_RD)) {
|
||||||
if((err = pipe_check(f->filp_ino, READING, 0,
|
if ((err = pipe_check(f->filp_ino, READING, 0,
|
||||||
1, f->filp_pos, &canwrite, 1)) != SUSPEND)
|
1, f->filp_pos, &canwrite, 1)) != SUSPEND)
|
||||||
r |= SEL_RD;
|
r |= SEL_RD;
|
||||||
if(err < 0 && err != SUSPEND && (*ops & SEL_ERR))
|
if (err < 0 && err != SUSPEND && (*ops & SEL_ERR))
|
||||||
r |= SEL_ERR;
|
r |= SEL_ERR;
|
||||||
}
|
}
|
||||||
if((*ops & SEL_WR)) {
|
if ((*ops & SEL_WR)) {
|
||||||
if((err = pipe_check(f->filp_ino, WRITING, 0,
|
if ((err = pipe_check(f->filp_ino, WRITING, 0,
|
||||||
1, f->filp_pos, &canwrite, 1)) != SUSPEND)
|
1, f->filp_pos, &canwrite, 1)) != SUSPEND)
|
||||||
r |= SEL_WR;
|
r |= SEL_WR;
|
||||||
if(err < 0 && err != SUSPEND && (*ops & SEL_ERR))
|
if (err < 0 && err != SUSPEND && (*ops & SEL_ERR))
|
||||||
r |= SEL_ERR;
|
r |= SEL_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
*ops = r;
|
*ops = r;
|
||||||
|
|
||||||
if(!r && block) {
|
if (!r && block) {
|
||||||
f->filp_pipe_select_ops |= orig_ops;
|
f->filp_pipe_select_ops |= orig_ops;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -379,7 +379,7 @@ PUBLIC int select_request_pipe(struct filp *f, int *ops, int block)
|
|||||||
PUBLIC int select_match_pipe(struct filp *f)
|
PUBLIC int select_match_pipe(struct filp *f)
|
||||||
{
|
{
|
||||||
/* recognize either pipe or named pipe (FIFO) */
|
/* recognize either pipe or named pipe (FIFO) */
|
||||||
if(f && f->filp_ino && (f->filp_ino->i_mode & I_NAMED_PIPE))
|
if (f && f->filp_ino && (f->filp_ino->i_mode & I_NAMED_PIPE))
|
||||||
return 1;
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ int rw_flag; /* READING or WRITING */
|
|||||||
/* left unfinished rw_chunk()s from previous call! this can't happen.
|
/* left unfinished rw_chunk()s from previous call! this can't happen.
|
||||||
* it means something has gone wrong we can't repair now.
|
* it means something has gone wrong we can't repair now.
|
||||||
*/
|
*/
|
||||||
if(bufs_in_use < 0) {
|
if (bufs_in_use < 0) {
|
||||||
panic(__FILE__,"start - bufs_in_use negative", bufs_in_use);
|
panic(__FILE__,"start - bufs_in_use negative", bufs_in_use);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,21 +100,21 @@ int rw_flag; /* READING or WRITING */
|
|||||||
mode_word = rip->i_mode & I_TYPE;
|
mode_word = rip->i_mode & I_TYPE;
|
||||||
regular = mode_word == I_REGULAR || mode_word == I_NAMED_PIPE;
|
regular = mode_word == I_REGULAR || mode_word == I_NAMED_PIPE;
|
||||||
|
|
||||||
if((char_spec = (mode_word == I_CHAR_SPECIAL ? 1 : 0))) {
|
if ((char_spec = (mode_word == I_CHAR_SPECIAL ? 1 : 0))) {
|
||||||
if(rip->i_zone[0] == NO_DEV)
|
if (rip->i_zone[0] == NO_DEV)
|
||||||
panic(__FILE__,"read_write tries to read from "
|
panic(__FILE__,"read_write tries to read from "
|
||||||
"character device NO_DEV", NO_NUM);
|
"character device NO_DEV", NO_NUM);
|
||||||
block_size = get_block_size(rip->i_zone[0]);
|
block_size = get_block_size(rip->i_zone[0]);
|
||||||
}
|
}
|
||||||
if((block_spec = (mode_word == I_BLOCK_SPECIAL ? 1 : 0))) {
|
if ((block_spec = (mode_word == I_BLOCK_SPECIAL ? 1 : 0))) {
|
||||||
f_size = ULONG_MAX;
|
f_size = ULONG_MAX;
|
||||||
if(rip->i_zone[0] == NO_DEV)
|
if (rip->i_zone[0] == NO_DEV)
|
||||||
panic(__FILE__,"read_write tries to read from "
|
panic(__FILE__,"read_write tries to read from "
|
||||||
" block device NO_DEV", NO_NUM);
|
" block device NO_DEV", NO_NUM);
|
||||||
block_size = get_block_size(rip->i_zone[0]);
|
block_size = get_block_size(rip->i_zone[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!char_spec && !block_spec)
|
if (!char_spec && !block_spec)
|
||||||
block_size = rip->i_sp->s_block_size;
|
block_size = rip->i_sp->s_block_size;
|
||||||
|
|
||||||
rdwt_err = OK; /* set to EIO if disk error occurs */
|
rdwt_err = OK; /* set to EIO if disk error occurs */
|
||||||
@ -197,7 +197,7 @@ int rw_flag; /* READING or WRITING */
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (rip->i_pipe == I_PIPE) {
|
if (rip->i_pipe == I_PIPE) {
|
||||||
if( position >= rip->i_size) {
|
if ( position >= rip->i_size) {
|
||||||
/* Reset pipe pointers. */
|
/* Reset pipe pointers. */
|
||||||
rip->i_size = 0; /* no data left */
|
rip->i_size = 0; /* no data left */
|
||||||
position = 0; /* reset reader(s) */
|
position = 0; /* reset reader(s) */
|
||||||
@ -240,7 +240,7 @@ int rw_flag; /* READING or WRITING */
|
|||||||
fp->fp_cum_io_partial = 0;
|
fp->fp_cum_io_partial = 0;
|
||||||
return(cum_io);
|
return(cum_io);
|
||||||
}
|
}
|
||||||
if(bufs_in_use < 0) {
|
if (bufs_in_use < 0) {
|
||||||
panic(__FILE__,"end - bufs_in_use negative", bufs_in_use);
|
panic(__FILE__,"end - bufs_in_use negative", bufs_in_use);
|
||||||
}
|
}
|
||||||
return(r);
|
return(r);
|
||||||
@ -305,7 +305,7 @@ int *completed; /* number of bytes copied */
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* In all cases, bp now points to a valid buffer. */
|
/* In all cases, bp now points to a valid buffer. */
|
||||||
if(bp == NIL_BUF) {
|
if (bp == NIL_BUF) {
|
||||||
panic(__FILE__,"bp not valid in rw_chunk, this can't happen", NO_NUM);
|
panic(__FILE__,"bp not valid in rw_chunk, this can't happen", NO_NUM);
|
||||||
}
|
}
|
||||||
if (rw_flag == WRITING && chunk != block_size && !block_spec &&
|
if (rw_flag == WRITING && chunk != block_size && !block_spec &&
|
||||||
|
@ -100,7 +100,7 @@ PRIVATE int select_request_file(struct filp *f, int *ops, int block)
|
|||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PRIVATE int select_match_file(struct filp *file)
|
PRIVATE int select_match_file(struct filp *file)
|
||||||
{
|
{
|
||||||
if(file && file->filp_ino && (file->filp_ino->i_mode & I_REGULAR))
|
if (file && file->filp_ino && (file->filp_ino->i_mode & I_REGULAR))
|
||||||
return 1;
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -111,9 +111,9 @@ PRIVATE int select_match_file(struct filp *file)
|
|||||||
PRIVATE int select_request_general(struct filp *f, int *ops, int block)
|
PRIVATE int select_request_general(struct filp *f, int *ops, int block)
|
||||||
{
|
{
|
||||||
int rops = *ops;
|
int rops = *ops;
|
||||||
if(block) rops |= SEL_NOTIFY;
|
if (block) rops |= SEL_NOTIFY;
|
||||||
*ops = dev_io(DEV_SELECT, f->filp_ino->i_zone[0], rops, NULL, 0, 0, 0);
|
*ops = dev_io(DEV_SELECT, f->filp_ino->i_zone[0], rops, NULL, 0, 0, 0);
|
||||||
if(*ops < 0)
|
if (*ops < 0)
|
||||||
return SEL_ERR;
|
return SEL_ERR;
|
||||||
return SEL_OK;
|
return SEL_OK;
|
||||||
}
|
}
|
||||||
@ -124,11 +124,11 @@ PRIVATE int select_request_general(struct filp *f, int *ops, int block)
|
|||||||
PRIVATE int select_major_match(int match_major, struct filp *file)
|
PRIVATE int select_major_match(int match_major, struct filp *file)
|
||||||
{
|
{
|
||||||
int major;
|
int major;
|
||||||
if(!(file && file->filp_ino &&
|
if (!(file && file->filp_ino &&
|
||||||
(file->filp_ino->i_mode & I_TYPE) == I_CHAR_SPECIAL))
|
(file->filp_ino->i_mode & I_TYPE) == I_CHAR_SPECIAL))
|
||||||
return 0;
|
return 0;
|
||||||
major = (file->filp_ino->i_zone[0] >> MAJOR) & BYTE;
|
major = (file->filp_ino->i_zone[0] >> MAJOR) & BYTE;
|
||||||
if(major == match_major)
|
if (major == match_major)
|
||||||
return 1;
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -142,17 +142,17 @@ PRIVATE int tab2ops(int fd, struct selectentry *e)
|
|||||||
|
|
||||||
PRIVATE void ops2tab(int ops, int fd, struct selectentry *e)
|
PRIVATE void ops2tab(int ops, int fd, struct selectentry *e)
|
||||||
{
|
{
|
||||||
if((ops & SEL_RD) && e->vir_readfds && FD_ISSET(fd, &e->readfds)
|
if ((ops & SEL_RD) && e->vir_readfds && FD_ISSET(fd, &e->readfds)
|
||||||
&& !FD_ISSET(fd, &e->ready_readfds)) {
|
&& !FD_ISSET(fd, &e->ready_readfds)) {
|
||||||
FD_SET(fd, &e->ready_readfds);
|
FD_SET(fd, &e->ready_readfds);
|
||||||
e->nreadyfds++;
|
e->nreadyfds++;
|
||||||
}
|
}
|
||||||
if((ops & SEL_WR) && e->vir_writefds && FD_ISSET(fd, &e->writefds)
|
if ((ops & SEL_WR) && e->vir_writefds && FD_ISSET(fd, &e->writefds)
|
||||||
&& !FD_ISSET(fd, &e->ready_writefds)) {
|
&& !FD_ISSET(fd, &e->ready_writefds)) {
|
||||||
FD_SET(fd, &e->ready_writefds);
|
FD_SET(fd, &e->ready_writefds);
|
||||||
e->nreadyfds++;
|
e->nreadyfds++;
|
||||||
}
|
}
|
||||||
if((ops & SEL_ERR) && e->vir_errorfds && FD_ISSET(fd, &e->errorfds)
|
if ((ops & SEL_ERR) && e->vir_errorfds && FD_ISSET(fd, &e->errorfds)
|
||||||
&& !FD_ISSET(fd, &e->ready_errorfds)) {
|
&& !FD_ISSET(fd, &e->ready_errorfds)) {
|
||||||
FD_SET(fd, &e->ready_errorfds);
|
FD_SET(fd, &e->ready_errorfds);
|
||||||
e->nreadyfds++;
|
e->nreadyfds++;
|
||||||
@ -163,13 +163,13 @@ PRIVATE void ops2tab(int ops, int fd, struct selectentry *e)
|
|||||||
|
|
||||||
PRIVATE void copy_fdsets(struct selectentry *e)
|
PRIVATE void copy_fdsets(struct selectentry *e)
|
||||||
{
|
{
|
||||||
if(e->vir_readfds)
|
if (e->vir_readfds)
|
||||||
sys_vircopy(SELF, D, (vir_bytes) &e->ready_readfds,
|
sys_vircopy(SELF, D, (vir_bytes) &e->ready_readfds,
|
||||||
e->req_procnr, D, (vir_bytes) e->vir_readfds, sizeof(fd_set));
|
e->req_procnr, D, (vir_bytes) e->vir_readfds, sizeof(fd_set));
|
||||||
if(e->vir_writefds)
|
if (e->vir_writefds)
|
||||||
sys_vircopy(SELF, D, (vir_bytes) &e->ready_writefds,
|
sys_vircopy(SELF, D, (vir_bytes) &e->ready_writefds,
|
||||||
e->req_procnr, D, (vir_bytes) e->vir_writefds, sizeof(fd_set));
|
e->req_procnr, D, (vir_bytes) e->vir_writefds, sizeof(fd_set));
|
||||||
if(e->vir_errorfds)
|
if (e->vir_errorfds)
|
||||||
sys_vircopy(SELF, D, (vir_bytes) &e->ready_errorfds,
|
sys_vircopy(SELF, D, (vir_bytes) &e->ready_errorfds,
|
||||||
e->req_procnr, D, (vir_bytes) e->vir_errorfds, sizeof(fd_set));
|
e->req_procnr, D, (vir_bytes) e->vir_errorfds, sizeof(fd_set));
|
||||||
|
|
||||||
@ -186,14 +186,14 @@ PUBLIC int do_select(void)
|
|||||||
struct timeval timeout;
|
struct timeval timeout;
|
||||||
nfds = m_in.SEL_NFDS;
|
nfds = m_in.SEL_NFDS;
|
||||||
|
|
||||||
if(nfds < 0 || nfds > FD_SETSIZE)
|
if (nfds < 0 || nfds > FD_SETSIZE)
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
for(s = 0; s < MAXSELECTS; s++)
|
for(s = 0; s < MAXSELECTS; s++)
|
||||||
if(!selecttab[s].requestor)
|
if (!selecttab[s].requestor)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if(s >= MAXSELECTS)
|
if (s >= MAXSELECTS)
|
||||||
return ENOSPC;
|
return ENOSPC;
|
||||||
|
|
||||||
selecttab[s].req_procnr = who;
|
selecttab[s].req_procnr = who;
|
||||||
@ -214,40 +214,40 @@ PUBLIC int do_select(void)
|
|||||||
selecttab[s].vir_errorfds = (fd_set *) m_in.SEL_ERRORFDS;
|
selecttab[s].vir_errorfds = (fd_set *) m_in.SEL_ERRORFDS;
|
||||||
|
|
||||||
/* copy args */
|
/* copy args */
|
||||||
if(selecttab[s].vir_readfds
|
if (selecttab[s].vir_readfds
|
||||||
&& (r=sys_vircopy(who, D, (vir_bytes) m_in.SEL_READFDS,
|
&& (r=sys_vircopy(who, D, (vir_bytes) m_in.SEL_READFDS,
|
||||||
SELF, D, (vir_bytes) &selecttab[s].readfds, sizeof(fd_set))) != OK)
|
SELF, D, (vir_bytes) &selecttab[s].readfds, sizeof(fd_set))) != OK)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
if(selecttab[s].vir_writefds
|
if (selecttab[s].vir_writefds
|
||||||
&& (r=sys_vircopy(who, D, (vir_bytes) m_in.SEL_WRITEFDS,
|
&& (r=sys_vircopy(who, D, (vir_bytes) m_in.SEL_WRITEFDS,
|
||||||
SELF, D, (vir_bytes) &selecttab[s].writefds, sizeof(fd_set))) != OK)
|
SELF, D, (vir_bytes) &selecttab[s].writefds, sizeof(fd_set))) != OK)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
if(selecttab[s].vir_errorfds
|
if (selecttab[s].vir_errorfds
|
||||||
&& (r=sys_vircopy(who, D, (vir_bytes) m_in.SEL_ERRORFDS,
|
&& (r=sys_vircopy(who, D, (vir_bytes) m_in.SEL_ERRORFDS,
|
||||||
SELF, D, (vir_bytes) &selecttab[s].errorfds, sizeof(fd_set))) != OK)
|
SELF, D, (vir_bytes) &selecttab[s].errorfds, sizeof(fd_set))) != OK)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
if(!m_in.SEL_TIMEOUT)
|
if (!m_in.SEL_TIMEOUT)
|
||||||
is_timeout = nonzero_timeout = 0;
|
is_timeout = nonzero_timeout = 0;
|
||||||
else
|
else
|
||||||
if((r=sys_vircopy(who, D, (vir_bytes) m_in.SEL_TIMEOUT,
|
if ((r=sys_vircopy(who, D, (vir_bytes) m_in.SEL_TIMEOUT,
|
||||||
SELF, D, (vir_bytes) &timeout, sizeof(timeout))) != OK)
|
SELF, D, (vir_bytes) &timeout, sizeof(timeout))) != OK)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
/* No nonsense in the timeval please. */
|
/* No nonsense in the timeval please. */
|
||||||
if(is_timeout && (timeout.tv_sec < 0 || timeout.tv_usec < 0))
|
if (is_timeout && (timeout.tv_sec < 0 || timeout.tv_usec < 0))
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
/* if is_timeout if 0, we block forever. otherwise, if nonzero_timeout
|
/* if is_timeout if 0, we block forever. otherwise, if nonzero_timeout
|
||||||
* is 0, we do a poll (don't block). otherwise, we block up to the
|
* is 0, we do a poll (don't block). otherwise, we block up to the
|
||||||
* specified time interval.
|
* specified time interval.
|
||||||
*/
|
*/
|
||||||
if(is_timeout && (timeout.tv_sec > 0 || timeout.tv_usec > 0))
|
if (is_timeout && (timeout.tv_sec > 0 || timeout.tv_usec > 0))
|
||||||
nonzero_timeout = 1;
|
nonzero_timeout = 1;
|
||||||
|
|
||||||
if(nonzero_timeout || !is_timeout)
|
if (nonzero_timeout || !is_timeout)
|
||||||
block = 1;
|
block = 1;
|
||||||
else
|
else
|
||||||
block = 0; /* timeout set as (0,0) - this effects a poll */
|
block = 0; /* timeout set as (0,0) - this effects a poll */
|
||||||
@ -259,24 +259,24 @@ PUBLIC int do_select(void)
|
|||||||
int orig_ops, ops, t, type = -1, r;
|
int orig_ops, ops, t, type = -1, r;
|
||||||
struct filp *filp;
|
struct filp *filp;
|
||||||
|
|
||||||
if(!(orig_ops = ops = tab2ops(fd, &selecttab[s])))
|
if (!(orig_ops = ops = tab2ops(fd, &selecttab[s])))
|
||||||
continue;
|
continue;
|
||||||
if(!(filp = selecttab[s].filps[fd] = get_filp(fd))) {
|
if (!(filp = selecttab[s].filps[fd] = get_filp(fd))) {
|
||||||
select_cancel_all(&selecttab[s]);
|
select_cancel_all(&selecttab[s]);
|
||||||
return EBADF;
|
return EBADF;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(t = 0; t < SEL_FDS; t++) {
|
for(t = 0; t < SEL_FDS; t++) {
|
||||||
if(fdtypes[t].select_match) {
|
if (fdtypes[t].select_match) {
|
||||||
if(fdtypes[t].select_match(filp)) {
|
if (fdtypes[t].select_match(filp)) {
|
||||||
#if DEBUG_SELECT
|
#if DEBUG_SELECT
|
||||||
printf("select: fd %d is type %d ", fd, t);
|
printf("select: fd %d is type %d ", fd, t);
|
||||||
#endif
|
#endif
|
||||||
if(type != -1)
|
if (type != -1)
|
||||||
printf("select: double match\n");
|
printf("select: double match\n");
|
||||||
type = t;
|
type = t;
|
||||||
}
|
}
|
||||||
} else if(select_major_match(fdtypes[t].select_major, filp)) {
|
} else if (select_major_match(fdtypes[t].select_major, filp)) {
|
||||||
type = t;
|
type = t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -291,7 +291,7 @@ PUBLIC int do_select(void)
|
|||||||
* If all types are implemented, then this is another
|
* If all types are implemented, then this is another
|
||||||
* type of file and we get to do whatever we want.
|
* type of file and we get to do whatever we want.
|
||||||
*/
|
*/
|
||||||
if(type == -1)
|
if (type == -1)
|
||||||
{
|
{
|
||||||
#if DEBUG_SELECT
|
#if DEBUG_SELECT
|
||||||
printf("do_select: bad type\n");
|
printf("do_select: bad type\n");
|
||||||
@ -301,7 +301,7 @@ PUBLIC int do_select(void)
|
|||||||
|
|
||||||
selecttab[s].type[fd] = type;
|
selecttab[s].type[fd] = type;
|
||||||
|
|
||||||
if((selecttab[s].filps[fd]->filp_select_ops & ops) != ops) {
|
if ((selecttab[s].filps[fd]->filp_select_ops & ops) != ops) {
|
||||||
int wantops;
|
int wantops;
|
||||||
/* Request the select on this fd. */
|
/* Request the select on this fd. */
|
||||||
#if DEBUG_SELECT
|
#if DEBUG_SELECT
|
||||||
@ -313,15 +313,15 @@ PUBLIC int do_select(void)
|
|||||||
#if DEBUG_SELECT
|
#if DEBUG_SELECT
|
||||||
printf("%d\n", selecttab[s].filps[fd]->filp_select_ops);
|
printf("%d\n", selecttab[s].filps[fd]->filp_select_ops);
|
||||||
#endif
|
#endif
|
||||||
if((r = fdtypes[type].select_request(filp,
|
if ((r = fdtypes[type].select_request(filp,
|
||||||
&wantops, block)) != SEL_OK) {
|
&wantops, block)) != SEL_OK) {
|
||||||
/* error or bogus return code.. backpaddle */
|
/* error or bogus return code.. backpaddle */
|
||||||
select_cancel_all(&selecttab[s]);
|
select_cancel_all(&selecttab[s]);
|
||||||
printf("select: select_request returned error\n");
|
printf("select: select_request returned error\n");
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
if(wantops) {
|
if (wantops) {
|
||||||
if(wantops & ops) {
|
if (wantops & ops) {
|
||||||
/* operations that were just requested
|
/* operations that were just requested
|
||||||
* are ready to go right away
|
* are ready to go right away
|
||||||
*/
|
*/
|
||||||
@ -350,7 +350,7 @@ PUBLIC int do_select(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if(selecttab[s].nreadyfds > 0 || !block) {
|
if (selecttab[s].nreadyfds > 0 || !block) {
|
||||||
/* fd's were found that were ready to go right away, and/or
|
/* fd's were found that were ready to go right away, and/or
|
||||||
* we were instructed not to block at all. Must return
|
* we were instructed not to block at all. Must return
|
||||||
* immediately.
|
* immediately.
|
||||||
@ -377,7 +377,7 @@ PUBLIC int do_select(void)
|
|||||||
/* Convert timeval to ticks and set the timer. If it fails, undo
|
/* Convert timeval to ticks and set the timer. If it fails, undo
|
||||||
* all, return error.
|
* all, return error.
|
||||||
*/
|
*/
|
||||||
if(is_timeout) {
|
if (is_timeout) {
|
||||||
int ticks;
|
int ticks;
|
||||||
/* Open Group:
|
/* Open Group:
|
||||||
* "If the requested timeout interval requires a finer
|
* "If the requested timeout interval requires a finer
|
||||||
@ -415,13 +415,13 @@ PRIVATE void select_cancel_all(struct selectentry *e)
|
|||||||
for(fd = 0; fd < e->nfds; fd++) {
|
for(fd = 0; fd < e->nfds; fd++) {
|
||||||
struct filp *fp;
|
struct filp *fp;
|
||||||
fp = e->filps[fd];
|
fp = e->filps[fd];
|
||||||
if(!fp) {
|
if (!fp) {
|
||||||
#if DEBUG_SELECT
|
#if DEBUG_SELECT
|
||||||
printf("[ fd %d/%d NULL ] ", fd, e->nfds);
|
printf("[ fd %d/%d NULL ] ", fd, e->nfds);
|
||||||
#endif
|
#endif
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(fp->filp_selectors < 1) {
|
if (fp->filp_selectors < 1) {
|
||||||
#if DEBUG_SELECT
|
#if DEBUG_SELECT
|
||||||
printf("select: %d selectors?!\n", fp->filp_selectors);
|
printf("select: %d selectors?!\n", fp->filp_selectors);
|
||||||
#endif
|
#endif
|
||||||
@ -432,7 +432,7 @@ PRIVATE void select_cancel_all(struct selectentry *e)
|
|||||||
select_reevaluate(fp);
|
select_reevaluate(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(e->expiry > 0) {
|
if (e->expiry > 0) {
|
||||||
#if DEBUG_SELECT
|
#if DEBUG_SELECT
|
||||||
printf("cancelling timer %d\n", e - selecttab);
|
printf("cancelling timer %d\n", e - selecttab);
|
||||||
#endif
|
#endif
|
||||||
@ -457,16 +457,16 @@ PRIVATE int select_reevaluate(struct filp *fp)
|
|||||||
{
|
{
|
||||||
int s, remain_ops = 0, fd, type = -1;
|
int s, remain_ops = 0, fd, type = -1;
|
||||||
|
|
||||||
if(!fp) {
|
if (!fp) {
|
||||||
printf("fs: select: reevalute NULL fp\n");
|
printf("fs: select: reevalute NULL fp\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(s = 0; s < MAXSELECTS; s++) {
|
for(s = 0; s < MAXSELECTS; s++) {
|
||||||
if(!selecttab[s].requestor)
|
if (!selecttab[s].requestor)
|
||||||
continue;
|
continue;
|
||||||
for(fd = 0; fd < selecttab[s].nfds; fd++)
|
for(fd = 0; fd < selecttab[s].nfds; fd++)
|
||||||
if(fp == selecttab[s].filps[fd]) {
|
if (fp == selecttab[s].filps[fd]) {
|
||||||
remain_ops |= tab2ops(fd, &selecttab[s]);
|
remain_ops |= tab2ops(fd, &selecttab[s]);
|
||||||
type = selecttab[s].type[fd];
|
type = selecttab[s].type[fd];
|
||||||
}
|
}
|
||||||
@ -485,7 +485,7 @@ PRIVATE int select_reevaluate(struct filp *fp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* int select_callback *
|
* select_callback *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PUBLIC int select_callback(struct filp *fp, int ops)
|
PUBLIC int select_callback(struct filp *fp, int ops)
|
||||||
{
|
{
|
||||||
@ -500,16 +500,16 @@ PUBLIC int select_callback(struct filp *fp, int ops)
|
|||||||
type = -1;
|
type = -1;
|
||||||
for(s = 0; s < MAXSELECTS; s++) {
|
for(s = 0; s < MAXSELECTS; s++) {
|
||||||
int wakehim = 0;
|
int wakehim = 0;
|
||||||
if(!selecttab[s].requestor)
|
if (!selecttab[s].requestor)
|
||||||
continue;
|
continue;
|
||||||
for(fd = 0; fd < selecttab[s].nfds; fd++) {
|
for(fd = 0; fd < selecttab[s].nfds; fd++) {
|
||||||
if(!selecttab[s].filps[fd])
|
if (!selecttab[s].filps[fd])
|
||||||
continue;
|
continue;
|
||||||
if(selecttab[s].filps[fd] == fp) {
|
if (selecttab[s].filps[fd] == fp) {
|
||||||
int this_want_ops;
|
int this_want_ops;
|
||||||
this_want_ops = tab2ops(fd, &selecttab[s]);
|
this_want_ops = tab2ops(fd, &selecttab[s]);
|
||||||
want_ops |= this_want_ops;
|
want_ops |= this_want_ops;
|
||||||
if(this_want_ops & ops) {
|
if (this_want_ops & ops) {
|
||||||
/* this select() has been satisfied. */
|
/* this select() has been satisfied. */
|
||||||
ops2tab(ops, fd, &selecttab[s]);
|
ops2tab(ops, fd, &selecttab[s]);
|
||||||
wakehim = 1;
|
wakehim = 1;
|
||||||
@ -517,7 +517,7 @@ PUBLIC int select_callback(struct filp *fp, int ops)
|
|||||||
type = selecttab[s].type[fd];
|
type = selecttab[s].type[fd];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(wakehim) {
|
if (wakehim) {
|
||||||
select_cancel_all(&selecttab[s]);
|
select_cancel_all(&selecttab[s]);
|
||||||
copy_fdsets(&selecttab[s]);
|
copy_fdsets(&selecttab[s]);
|
||||||
selecttab[s].requestor = NULL;
|
selecttab[s].requestor = NULL;
|
||||||
@ -529,7 +529,7 @@ PUBLIC int select_callback(struct filp *fp, int ops)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* int select_notified *
|
* select_notified *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PUBLIC int select_notified(int major, int minor, int selected_ops)
|
PUBLIC int select_notified(int major, int minor, int selected_ops)
|
||||||
{
|
{
|
||||||
@ -540,10 +540,10 @@ PUBLIC int select_notified(int major, int minor, int selected_ops)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
for(t = 0; t < SEL_FDS; t++)
|
for(t = 0; t < SEL_FDS; t++)
|
||||||
if(!fdtypes[t].select_match && fdtypes[t].select_major == major)
|
if (!fdtypes[t].select_match && fdtypes[t].select_major == major)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if(t >= SEL_FDS) {
|
if (t >= SEL_FDS) {
|
||||||
#if DEBUG_SELECT
|
#if DEBUG_SELECT
|
||||||
printf("select callback: no fdtype found for device %d\n", major);
|
printf("select callback: no fdtype found for device %d\n", major);
|
||||||
#endif
|
#endif
|
||||||
@ -556,15 +556,15 @@ PUBLIC int select_notified(int major, int minor, int selected_ops)
|
|||||||
|
|
||||||
for(s = 0; s < MAXSELECTS; s++) {
|
for(s = 0; s < MAXSELECTS; s++) {
|
||||||
int s_minor, ops;
|
int s_minor, ops;
|
||||||
if(!selecttab[s].requestor)
|
if (!selecttab[s].requestor)
|
||||||
continue;
|
continue;
|
||||||
for(f = 0; f < selecttab[s].nfds; f++) {
|
for(f = 0; f < selecttab[s].nfds; f++) {
|
||||||
if(!selecttab[s].filps[f] ||
|
if (!selecttab[s].filps[f] ||
|
||||||
!select_major_match(major, selecttab[s].filps[f]))
|
!select_major_match(major, selecttab[s].filps[f]))
|
||||||
continue;
|
continue;
|
||||||
ops = tab2ops(f, &selecttab[s]);
|
ops = tab2ops(f, &selecttab[s]);
|
||||||
s_minor = selecttab[s].filps[f]->filp_ino->i_zone[0] & BYTE;
|
s_minor = selecttab[s].filps[f]->filp_ino->i_zone[0] & BYTE;
|
||||||
if((s_minor == minor) &&
|
if ((s_minor == minor) &&
|
||||||
(selected_ops & ops)) {
|
(selected_ops & ops)) {
|
||||||
select_callback(selecttab[s].filps[f], (selected_ops & ops));
|
select_callback(selecttab[s].filps[f], (selected_ops & ops));
|
||||||
}
|
}
|
||||||
@ -586,7 +586,7 @@ PUBLIC void init_select(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* int select_forget *
|
* select_forget *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PUBLIC void select_forget(int proc)
|
PUBLIC void select_forget(int proc)
|
||||||
{
|
{
|
||||||
@ -596,14 +596,14 @@ PUBLIC void select_forget(int proc)
|
|||||||
int s;
|
int s;
|
||||||
|
|
||||||
for(s = 0; s < MAXSELECTS; s++) {
|
for(s = 0; s < MAXSELECTS; s++) {
|
||||||
if(selecttab[s].requestor &&
|
if (selecttab[s].requestor &&
|
||||||
selecttab[s].req_procnr == proc) {
|
selecttab[s].req_procnr == proc) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(s >= MAXSELECTS) {
|
if (s >= MAXSELECTS) {
|
||||||
#if DEBUG_SELECT
|
#if DEBUG_SELECT
|
||||||
printf("select: cancelled select() not found");
|
printf("select: cancelled select() not found");
|
||||||
#endif
|
#endif
|
||||||
@ -617,7 +617,7 @@ PUBLIC void select_forget(int proc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* int select_timeout_check *
|
* select_timeout_check *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PUBLIC void select_timeout_check(timer_t *timer)
|
PUBLIC void select_timeout_check(timer_t *timer)
|
||||||
{
|
{
|
||||||
@ -625,21 +625,21 @@ PUBLIC void select_timeout_check(timer_t *timer)
|
|||||||
|
|
||||||
s = tmr_arg(timer)->ta_int;
|
s = tmr_arg(timer)->ta_int;
|
||||||
|
|
||||||
if(s < 0 || s >= MAXSELECTS) {
|
if (s < 0 || s >= MAXSELECTS) {
|
||||||
#if DEBUG_SELECT
|
#if DEBUG_SELECT
|
||||||
printf("select: bogus slot arg to watchdog %d\n", s);
|
printf("select: bogus slot arg to watchdog %d\n", s);
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!selecttab[s].requestor) {
|
if (!selecttab[s].requestor) {
|
||||||
#if DEBUG_SELECT
|
#if DEBUG_SELECT
|
||||||
printf("select: no requestor in watchdog\n");
|
printf("select: no requestor in watchdog\n");
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(selecttab[s].expiry <= 0) {
|
if (selecttab[s].expiry <= 0) {
|
||||||
#if DEBUG_SELECT
|
#if DEBUG_SELECT
|
||||||
printf("select: strange expiry value in watchdog\n", s);
|
printf("select: strange expiry value in watchdog\n", s);
|
||||||
#endif
|
#endif
|
||||||
|
@ -150,7 +150,7 @@ dev_t dev; /* device number whose super_block is sought */
|
|||||||
|
|
||||||
register struct super_block *sp;
|
register struct super_block *sp;
|
||||||
|
|
||||||
if(dev == NO_DEV)
|
if (dev == NO_DEV)
|
||||||
panic(__FILE__,"request for super_block of NO_DEV", NO_NUM);
|
panic(__FILE__,"request for super_block of NO_DEV", NO_NUM);
|
||||||
|
|
||||||
for (sp = &super_block[0]; sp < &super_block[NR_SUPERS]; sp++)
|
for (sp = &super_block[0]; sp < &super_block[NR_SUPERS]; sp++)
|
||||||
@ -171,7 +171,7 @@ PUBLIC int get_block_size(dev_t dev)
|
|||||||
|
|
||||||
register struct super_block *sp;
|
register struct super_block *sp;
|
||||||
|
|
||||||
if(dev == NO_DEV)
|
if (dev == NO_DEV)
|
||||||
panic(__FILE__,"request for block size of NO_DEV", NO_NUM);
|
panic(__FILE__,"request for block size of NO_DEV", NO_NUM);
|
||||||
|
|
||||||
for (sp = &super_block[0]; sp < &super_block[NR_SUPERS]; sp++) {
|
for (sp = &super_block[0]; sp < &super_block[NR_SUPERS]; sp++) {
|
||||||
@ -217,11 +217,11 @@ register struct super_block *sp; /* pointer to a superblock */
|
|||||||
static char sbbuf[MIN_BLOCK_SIZE];
|
static char sbbuf[MIN_BLOCK_SIZE];
|
||||||
|
|
||||||
dev = sp->s_dev; /* save device (will be overwritten by copy) */
|
dev = sp->s_dev; /* save device (will be overwritten by copy) */
|
||||||
if(dev == NO_DEV)
|
if (dev == NO_DEV)
|
||||||
panic(__FILE__,"request for super_block of NO_DEV", NO_NUM);
|
panic(__FILE__,"request for super_block of NO_DEV", NO_NUM);
|
||||||
r = dev_io(DEV_READ, dev, FS_PROC_NR,
|
r = dev_io(DEV_READ, dev, FS_PROC_NR,
|
||||||
sbbuf, SUPER_BLOCK_BYTES, MIN_BLOCK_SIZE, 0);
|
sbbuf, SUPER_BLOCK_BYTES, MIN_BLOCK_SIZE, 0);
|
||||||
if(r != MIN_BLOCK_SIZE) {
|
if (r != MIN_BLOCK_SIZE) {
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
memcpy(sp, sbbuf, sizeof(*sp));
|
memcpy(sp, sbbuf, sizeof(*sp));
|
||||||
@ -271,31 +271,31 @@ register struct super_block *sp; /* pointer to a superblock */
|
|||||||
sp->s_ndzones = V1_NR_DZONES;
|
sp->s_ndzones = V1_NR_DZONES;
|
||||||
sp->s_nindirs = V1_INDIRECTS;
|
sp->s_nindirs = V1_INDIRECTS;
|
||||||
} else {
|
} else {
|
||||||
if(version == V2)
|
if (version == V2)
|
||||||
sp->s_block_size = STATIC_BLOCK_SIZE;
|
sp->s_block_size = STATIC_BLOCK_SIZE;
|
||||||
if(sp->s_block_size < MIN_BLOCK_SIZE)
|
if (sp->s_block_size < MIN_BLOCK_SIZE)
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
sp->s_inodes_per_block = V2_INODES_PER_BLOCK(sp->s_block_size);
|
sp->s_inodes_per_block = V2_INODES_PER_BLOCK(sp->s_block_size);
|
||||||
sp->s_ndzones = V2_NR_DZONES;
|
sp->s_ndzones = V2_NR_DZONES;
|
||||||
sp->s_nindirs = V2_INDIRECTS(sp->s_block_size);
|
sp->s_nindirs = V2_INDIRECTS(sp->s_block_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sp->s_block_size < MIN_BLOCK_SIZE) {
|
if (sp->s_block_size < MIN_BLOCK_SIZE) {
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
if(sp->s_block_size > MAX_BLOCK_SIZE) {
|
if (sp->s_block_size > MAX_BLOCK_SIZE) {
|
||||||
printf("Filesystem block size is %d kB; maximum filesystem\n"
|
printf("Filesystem block size is %d kB; maximum filesystem\n"
|
||||||
"block size is %d kB. This limit can be increased by recompiling.\n",
|
"block size is %d kB. This limit can be increased by recompiling.\n",
|
||||||
sp->s_block_size/1024, MAX_BLOCK_SIZE/1024);
|
sp->s_block_size/1024, MAX_BLOCK_SIZE/1024);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
if((sp->s_block_size % 512) != 0) {
|
if ((sp->s_block_size % 512) != 0) {
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
if(SUPER_SIZE > sp->s_block_size) {
|
if (SUPER_SIZE > sp->s_block_size) {
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
if((sp->s_block_size % V2_INODE_SIZE) != 0 ||
|
if ((sp->s_block_size % V2_INODE_SIZE) != 0 ||
|
||||||
(sp->s_block_size % V1_INODE_SIZE) != 0) {
|
(sp->s_block_size % V1_INODE_SIZE) != 0) {
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ PUBLIC void fs_set_timer(timer_t *tp, int ticks, tmr_func_t watchdog, int arg)
|
|||||||
int r;
|
int r;
|
||||||
clock_t now, old_head = 0, new_head;
|
clock_t now, old_head = 0, new_head;
|
||||||
|
|
||||||
if((r = getuptime(&now)) != OK)
|
if ((r = getuptime(&now)) != OK)
|
||||||
panic(__FILE__, "FS couldn't get uptime from system task.", NO_NUM);
|
panic(__FILE__, "FS couldn't get uptime from system task.", NO_NUM);
|
||||||
|
|
||||||
tmr_arg(tp)->ta_int = arg;
|
tmr_arg(tp)->ta_int = arg;
|
||||||
@ -22,8 +22,8 @@ PUBLIC void fs_set_timer(timer_t *tp, int ticks, tmr_func_t watchdog, int arg)
|
|||||||
old_head = tmrs_settimer(&fs_timers, tp, now+ticks, watchdog, &new_head);
|
old_head = tmrs_settimer(&fs_timers, tp, now+ticks, watchdog, &new_head);
|
||||||
|
|
||||||
/* reschedule our synchronous alarm if necessary */
|
/* reschedule our synchronous alarm if necessary */
|
||||||
if(!old_head || old_head > new_head) {
|
if (!old_head || old_head > new_head) {
|
||||||
if(sys_setalarm(new_head, 1) != OK)
|
if (sys_setalarm(new_head, 1) != OK)
|
||||||
panic(__FILE__, "FS set timer "
|
panic(__FILE__, "FS set timer "
|
||||||
"couldn't set synchronous alarm.", NO_NUM);
|
"couldn't set synchronous alarm.", NO_NUM);
|
||||||
}
|
}
|
||||||
@ -35,8 +35,8 @@ PUBLIC void fs_expire_timers(clock_t now)
|
|||||||
{
|
{
|
||||||
clock_t new_head;
|
clock_t new_head;
|
||||||
tmrs_exptimers(&fs_timers, now, &new_head);
|
tmrs_exptimers(&fs_timers, now, &new_head);
|
||||||
if(new_head > 0) {
|
if (new_head > 0) {
|
||||||
if(sys_setalarm(new_head, 1) != OK)
|
if (sys_setalarm(new_head, 1) != OK)
|
||||||
panic(__FILE__, "FS expire timer couldn't set "
|
panic(__FILE__, "FS expire timer couldn't set "
|
||||||
"synchronous alarm.", NO_NUM);
|
"synchronous alarm.", NO_NUM);
|
||||||
}
|
}
|
||||||
@ -57,8 +57,8 @@ PUBLIC void fs_cancel_timer(timer_t *tp)
|
|||||||
* altogether if th last time has been cancelled (new_head
|
* altogether if th last time has been cancelled (new_head
|
||||||
* will be 0 then).
|
* will be 0 then).
|
||||||
*/
|
*/
|
||||||
if(old_head < new_head || !new_head) {
|
if (old_head < new_head || !new_head) {
|
||||||
if(sys_setalarm(new_head, 1) != OK)
|
if (sys_setalarm(new_head, 1) != OK)
|
||||||
panic(__FILE__,
|
panic(__FILE__,
|
||||||
"FS expire timer couldn't set synchronous alarm.",
|
"FS expire timer couldn't set synchronous alarm.",
|
||||||
NO_NUM);
|
NO_NUM);
|
||||||
|
@ -46,7 +46,7 @@ PUBLIC void timing_dmp()
|
|||||||
|
|
||||||
for(c = 0; c < TIMING_CATEGORIES; c++) {
|
for(c = 0; c < TIMING_CATEGORIES; c++) {
|
||||||
int b;
|
int b;
|
||||||
if(!timingdata[c].lock_timings_range[0] || !timingdata[c].binsize)
|
if (!timingdata[c].lock_timings_range[0] || !timingdata[c].binsize)
|
||||||
continue;
|
continue;
|
||||||
x = printf("%-*s: misses %lu, resets %lu, measurements %lu: ",
|
x = printf("%-*s: misses %lu, resets %lu, measurements %lu: ",
|
||||||
TIMING_NAME, timingdata[c].names,
|
TIMING_NAME, timingdata[c].names,
|
||||||
@ -55,14 +55,14 @@ PUBLIC void timing_dmp()
|
|||||||
timingdata[c].measurements);
|
timingdata[c].measurements);
|
||||||
for(b = 0; b < TIMING_POINTS; b++) {
|
for(b = 0; b < TIMING_POINTS; b++) {
|
||||||
int w;
|
int w;
|
||||||
if(!timingdata[c].lock_timings[b])
|
if (!timingdata[c].lock_timings[b])
|
||||||
continue;
|
continue;
|
||||||
x += (w = printf(" %5d: %5d", timingdata[c].lock_timings_range[0] +
|
x += (w = printf(" %5d: %5d", timingdata[c].lock_timings_range[0] +
|
||||||
b*timingdata[c].binsize,
|
b*timingdata[c].binsize,
|
||||||
timingdata[c].lock_timings[b]));
|
timingdata[c].lock_timings[b]));
|
||||||
if(x + w >= 80) { printf("\n"); x = 0; }
|
if (x + w >= 80) { printf("\n"); x = 0; }
|
||||||
}
|
}
|
||||||
if(x > 0) printf("\n");
|
if (x > 0) printf("\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -243,7 +243,7 @@ PUBLIC void sched_dmp()
|
|||||||
|
|
||||||
for (r=0;r<NR_SCHED_QUEUES; r++) {
|
for (r=0;r<NR_SCHED_QUEUES; r++) {
|
||||||
rp = rdy_head[r];
|
rp = rdy_head[r];
|
||||||
if(!rp) continue;
|
if (!rp) continue;
|
||||||
printf("%2d: ", r);
|
printf("%2d: ", r);
|
||||||
while (rp != NIL_PROC) {
|
while (rp != NIL_PROC) {
|
||||||
printf("%3d ", rp->p_nr);
|
printf("%3d ", rp->p_nr);
|
||||||
|
@ -268,9 +268,9 @@ PRIVATE void pm_init()
|
|||||||
printf(" free %u KB.\n", click_to_round_k(free_clicks));
|
printf(" free %u KB.\n", click_to_round_k(free_clicks));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*=========================================================================*
|
/*===========================================================================*
|
||||||
* get_nice_value *
|
* get_nice_value *
|
||||||
*=========================================================================*/
|
*===========================================================================*/
|
||||||
PRIVATE int get_nice_value(queue)
|
PRIVATE int get_nice_value(queue)
|
||||||
int queue; /* store mem chunks here */
|
int queue; /* store mem chunks here */
|
||||||
{
|
{
|
||||||
@ -295,9 +295,9 @@ int queue; /* store mem chunks here */
|
|||||||
#define MAX_16BIT (0xFFF0L << CLICK_SHIFT)
|
#define MAX_16BIT (0xFFF0L << CLICK_SHIFT)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*=========================================================================*
|
/*===========================================================================*
|
||||||
* get_mem_chunks *
|
* get_mem_chunks *
|
||||||
*=========================================================================*/
|
*===========================================================================*/
|
||||||
PRIVATE void get_mem_chunks(mem_chunks)
|
PRIVATE void get_mem_chunks(mem_chunks)
|
||||||
struct memory *mem_chunks; /* store mem chunks here */
|
struct memory *mem_chunks; /* store mem chunks here */
|
||||||
{
|
{
|
||||||
@ -358,9 +358,9 @@ struct memory *mem_chunks; /* store mem chunks here */
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*=========================================================================*
|
/*===========================================================================*
|
||||||
* patch_mem_chunks *
|
* patch_mem_chunks *
|
||||||
*=========================================================================*/
|
*===========================================================================*/
|
||||||
PRIVATE void patch_mem_chunks(mem_chunks, map_ptr)
|
PRIVATE void patch_mem_chunks(mem_chunks, map_ptr)
|
||||||
struct memory *mem_chunks; /* store mem chunks here */
|
struct memory *mem_chunks; /* store mem chunks here */
|
||||||
struct mem_map *map_ptr; /* memory to remove */
|
struct mem_map *map_ptr; /* memory to remove */
|
||||||
|
@ -123,9 +123,9 @@ PUBLIC int do_getprocnr()
|
|||||||
return(OK);
|
return(OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*=====================================================================*
|
/*===========================================================================*
|
||||||
* do_reboot *
|
* do_reboot *
|
||||||
*=====================================================================*/
|
*===========================================================================*/
|
||||||
#define REBOOT_CODE "delay; boot"
|
#define REBOOT_CODE "delay; boot"
|
||||||
PUBLIC int do_reboot()
|
PUBLIC int do_reboot()
|
||||||
{
|
{
|
||||||
@ -169,9 +169,9 @@ PUBLIC int do_reboot()
|
|||||||
return(SUSPEND); /* don't reply to killed process */
|
return(SUSPEND); /* don't reply to killed process */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*=====================================================================*
|
/*===========================================================================*
|
||||||
* do_getsetpriority *
|
* do_getsetpriority *
|
||||||
*=====================================================================*/
|
*===========================================================================*/
|
||||||
PUBLIC int do_getsetpriority()
|
PUBLIC int do_getsetpriority()
|
||||||
{
|
{
|
||||||
int arg_which, arg_who, arg_pri;
|
int arg_which, arg_who, arg_pri;
|
||||||
@ -185,28 +185,28 @@ PUBLIC int do_getsetpriority()
|
|||||||
/* Code common to GETPRIORITY and SETPRIORITY. */
|
/* Code common to GETPRIORITY and SETPRIORITY. */
|
||||||
|
|
||||||
/* Only support PRIO_PROCESS for now. */
|
/* Only support PRIO_PROCESS for now. */
|
||||||
if(arg_which != PRIO_PROCESS)
|
if (arg_which != PRIO_PROCESS)
|
||||||
return(EINVAL);
|
return(EINVAL);
|
||||||
|
|
||||||
if(arg_who == 0)
|
if (arg_who == 0)
|
||||||
rmp_nr = who;
|
rmp_nr = who;
|
||||||
else
|
else
|
||||||
if((rmp_nr = proc_from_pid(arg_who)) < 0)
|
if ((rmp_nr = proc_from_pid(arg_who)) < 0)
|
||||||
return(ESRCH);
|
return(ESRCH);
|
||||||
|
|
||||||
rmp = &mproc[rmp_nr];
|
rmp = &mproc[rmp_nr];
|
||||||
|
|
||||||
if(mp->mp_effuid != SUPER_USER &&
|
if (mp->mp_effuid != SUPER_USER &&
|
||||||
mp->mp_effuid != rmp->mp_effuid && mp->mp_effuid != rmp->mp_realuid)
|
mp->mp_effuid != rmp->mp_effuid && mp->mp_effuid != rmp->mp_realuid)
|
||||||
return EPERM;
|
return EPERM;
|
||||||
|
|
||||||
/* If GET, that's it. */
|
/* If GET, that's it. */
|
||||||
if(call_nr == GETPRIORITY) {
|
if (call_nr == GETPRIORITY) {
|
||||||
return(rmp->mp_nice - PRIO_MIN);
|
return(rmp->mp_nice - PRIO_MIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Only root is allowed to reduce the nice level. */
|
/* Only root is allowed to reduce the nice level. */
|
||||||
if(rmp->mp_nice > arg_pri && mp->mp_effuid != SUPER_USER)
|
if (rmp->mp_nice > arg_pri && mp->mp_effuid != SUPER_USER)
|
||||||
return(EACCES);
|
return(EACCES);
|
||||||
|
|
||||||
/* We're SET, and it's allowed. Do it and tell kernel. */
|
/* We're SET, and it's allowed. Do it and tell kernel. */
|
||||||
@ -214,9 +214,9 @@ PUBLIC int do_getsetpriority()
|
|||||||
return sys_nice(rmp_nr, arg_pri);
|
return sys_nice(rmp_nr, arg_pri);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*=====================================================================*
|
/*===========================================================================*
|
||||||
* do_svrctl *
|
* do_svrctl *
|
||||||
*=====================================================================*/
|
*===========================================================================*/
|
||||||
PUBLIC int do_svrctl()
|
PUBLIC int do_svrctl()
|
||||||
{
|
{
|
||||||
int s, req;
|
int s, req;
|
||||||
@ -249,9 +249,9 @@ PUBLIC int do_svrctl()
|
|||||||
sizeof(sysgetenv)) != OK) return(EFAULT);
|
sizeof(sysgetenv)) != OK) return(EFAULT);
|
||||||
|
|
||||||
/* Set a param override? */
|
/* Set a param override? */
|
||||||
if(req == MMSETPARAM) {
|
if (req == MMSETPARAM) {
|
||||||
if(local_params >= MAX_LOCAL_PARAMS) return ENOSPC;
|
if (local_params >= MAX_LOCAL_PARAMS) return ENOSPC;
|
||||||
if(sysgetenv.keylen <= 0
|
if (sysgetenv.keylen <= 0
|
||||||
|| sysgetenv.keylen >=
|
|| sysgetenv.keylen >=
|
||||||
sizeof(local_param_overrides[local_params].name)
|
sizeof(local_param_overrides[local_params].name)
|
||||||
|| sysgetenv.vallen <= 0
|
|| sysgetenv.vallen <= 0
|
||||||
@ -292,12 +292,12 @@ PUBLIC int do_svrctl()
|
|||||||
*/
|
*/
|
||||||
search_key[sysgetenv.keylen-1]= '\0';
|
search_key[sysgetenv.keylen-1]= '\0';
|
||||||
for(p = 0; p < local_params; p++) {
|
for(p = 0; p < local_params; p++) {
|
||||||
if(!strcmp(search_key, local_param_overrides[p].name)) {
|
if (!strcmp(search_key, local_param_overrides[p].name)) {
|
||||||
val_start = local_param_overrides[p].value;
|
val_start = local_param_overrides[p].value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(p >= local_params && (val_start = find_param(search_key)) == NULL)
|
if (p >= local_params && (val_start = find_param(search_key)) == NULL)
|
||||||
return(ESRCH);
|
return(ESRCH);
|
||||||
val_len = strlen(val_start) + 1;
|
val_len = strlen(val_start) + 1;
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ PUBLIC void pm_set_timer(timer_t *tp, int ticks, tmr_func_t watchdog, int arg)
|
|||||||
int r;
|
int r;
|
||||||
clock_t now, prev_time = 0, next_time;
|
clock_t now, prev_time = 0, next_time;
|
||||||
|
|
||||||
if((r = getuptime(&now)) != OK)
|
if ((r = getuptime(&now)) != OK)
|
||||||
panic(__FILE__, "PM couldn't get uptime", NO_NUM);
|
panic(__FILE__, "PM couldn't get uptime", NO_NUM);
|
||||||
|
|
||||||
/* Set timer argument and add timer to the list. */
|
/* Set timer argument and add timer to the list. */
|
||||||
@ -37,8 +37,8 @@ PUBLIC void pm_set_timer(timer_t *tp, int ticks, tmr_func_t watchdog, int arg)
|
|||||||
prev_time = tmrs_settimer(&pm_timers,tp,now+ticks,watchdog,&next_time);
|
prev_time = tmrs_settimer(&pm_timers,tp,now+ticks,watchdog,&next_time);
|
||||||
|
|
||||||
/* Reschedule our synchronous alarm if necessary. */
|
/* Reschedule our synchronous alarm if necessary. */
|
||||||
if(! prev_time || prev_time > next_time) {
|
if (! prev_time || prev_time > next_time) {
|
||||||
if(sys_setalarm(next_time, 1) != OK)
|
if (sys_setalarm(next_time, 1) != OK)
|
||||||
panic(__FILE__, "PM set timer couldn't set alarm.", NO_NUM);
|
panic(__FILE__, "PM set timer couldn't set alarm.", NO_NUM);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,8 +54,8 @@ PUBLIC void pm_expire_timers(clock_t now)
|
|||||||
|
|
||||||
/* Check for expired timers and possibly reschedule an alarm. */
|
/* Check for expired timers and possibly reschedule an alarm. */
|
||||||
tmrs_exptimers(&pm_timers, now, &next_time);
|
tmrs_exptimers(&pm_timers, now, &next_time);
|
||||||
if(next_time > 0) {
|
if (next_time > 0) {
|
||||||
if(sys_setalarm(next_time, 1) != OK)
|
if (sys_setalarm(next_time, 1) != OK)
|
||||||
panic(__FILE__, "PM expire timer couldn't set alarm.", NO_NUM);
|
panic(__FILE__, "PM expire timer couldn't set alarm.", NO_NUM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -72,8 +72,8 @@ PUBLIC void pm_cancel_timer(timer_t *tp)
|
|||||||
* the next timer, or cancel the alarm altogether if the last timer has
|
* the next timer, or cancel the alarm altogether if the last timer has
|
||||||
* been cancelled (next_time will be 0 then).
|
* been cancelled (next_time will be 0 then).
|
||||||
*/
|
*/
|
||||||
if(prev_time < next_time || ! next_time) {
|
if (prev_time < next_time || ! next_time) {
|
||||||
if(sys_setalarm(next_time, 1) != OK)
|
if (sys_setalarm(next_time, 1) != OK)
|
||||||
panic(__FILE__, "PM expire timer couldn't set alarm.", NO_NUM);
|
panic(__FILE__, "PM expire timer couldn't set alarm.", NO_NUM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,9 +144,9 @@ int what, p1, p2, p3;
|
|||||||
_taskcall(FS_PROC_NR, what, &m);
|
_taskcall(FS_PROC_NR, what, &m);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*==========================================================================*
|
/*===========================================================================*
|
||||||
* find_param *
|
* find_param *
|
||||||
*==========================================================================*/
|
*===========================================================================*/
|
||||||
PUBLIC char *find_param(name)
|
PUBLIC char *find_param(name)
|
||||||
const char *name;
|
const char *name;
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user