Fix printfs with too few or too many parms, remove unused vars, fix incorrect flag tests, other code cleanup.

This commit is contained in:
Kees van Reeuwijk 2010-04-01 13:25:05 +00:00
parent c3f649557e
commit fc7dced1fa
59 changed files with 127 additions and 222 deletions

View File

@ -424,7 +424,7 @@ static void restore_screen(void)
sizeof(boot_tty_info)); sizeof(boot_tty_info));
if(boot_tty_info.magic == TTYMAGIC) { if(boot_tty_info.magic == TTYMAGIC) {
if(boot_tty_info.flags & (BTIF_CONSORIGIN|BTIF_CONSCURSOR) == if((boot_tty_info.flags & (BTIF_CONSORIGIN|BTIF_CONSCURSOR)) ==
(BTIF_CONSORIGIN|BTIF_CONSCURSOR)) { (BTIF_CONSORIGIN|BTIF_CONSCURSOR)) {
int line; int line;
raw_copy(mon2abs(consolescreen), raw_copy(mon2abs(consolescreen),

View File

@ -1307,7 +1307,6 @@ int main(int argc, char **argv)
/* Driver task. /* Driver task.
*/ */
message m; message m;
sigset_t set;
int r; int r;
/* Initialize SEF. */ /* Initialize SEF. */

View File

@ -260,15 +260,15 @@ PRIVATE void do_conf(const message * mp)
} }
} else { /* Port number is out of range */ } else { /* Port number is out of range */
port = ENXIO; port = ENXIO;
dep = NULL;
} }
reply_mess.m_type = DL_CONF_REPLY; reply_mess.m_type = DL_CONF_REPLY;
reply_mess.m3_i1 = port; reply_mess.m3_i1 = port;
reply_mess.m3_i2 = DE_PORT_NR; reply_mess.m3_i2 = DE_PORT_NR;
/* FIXME: if port number is out of range, this uses if(dep != NULL){
* uninitialized variable 'dep'.
*/
*(ether_addr_t *) reply_mess.m3_ca1 = dep->de_address; *(ether_addr_t *) reply_mess.m3_ca1 = dep->de_address;
}
if (send(mp->m_source, &reply_mess) != OK) if (send(mp->m_source, &reply_mess) != OK)
panic(str_SendErrMsg, mp->m_source); panic(str_SendErrMsg, mp->m_source);
@ -291,7 +291,7 @@ PRIVATE void do_get_name(message *mp)
PRIVATE void do_reply(dpeth_t * dep, int err, int may_block) PRIVATE void do_reply(dpeth_t * dep, int err, int may_block)
{ {
message reply; message reply;
int status = FALSE; int status = 0;
if (dep->de_flags & DEF_ACK_SEND) status |= DL_PACK_SEND; if (dep->de_flags & DEF_ACK_SEND) status |= DL_PACK_SEND;
if (dep->de_flags & DEF_ACK_RECV) status |= DL_PACK_RECV; if (dep->de_flags & DEF_ACK_RECV) status |= DL_PACK_RECV;
@ -620,7 +620,6 @@ PRIVATE void de_first_init(dpeth_t *dep)
int i,j,r; int i,j,r;
vir_bytes descr_vir = dep->sendrecv_descr_buf; vir_bytes descr_vir = dep->sendrecv_descr_buf;
vir_bytes buffer_vir = dep->sendrecv_buf; vir_bytes buffer_vir = dep->sendrecv_buf;
de_descr_t *phys_descr;
de_loc_descr_t *loc_descr; de_loc_descr_t *loc_descr;
u32_t temp; u32_t temp;

View File

@ -624,8 +624,8 @@ int hermes_read_ltv (hermes_t * hw, int bap, u16_t rid, unsigned bufsize,
if (rtype != rid) { if (rtype != rid) {
printf("hermes @ %lx: hermes_read_ltv(): rid (0x%04x)", printf("hermes @ %lx: hermes_read_ltv(): rid (0x%04x)",
hw->iobase); hw->iobase, rid);
printf("does not match type (0x%04x)\n", rid, rtype); printf("does not match type (0x%04x)\n", rtype);
} }
if (HERMES_RECLEN_TO_BYTES (rlength) > bufsize) { if (HERMES_RECLEN_TO_BYTES (rlength) > bufsize) {

View File

@ -1168,7 +1168,7 @@ int devind;
/*===========================================================================* /*===========================================================================*
* record_bars * * record_bars *
*===========================================================================*/ *===========================================================================*/
PRIVATE void record_bars(devind, last_reg) PRIVATE void record_bars(int devind, int last_reg)
{ {
int i, reg, width; int i, reg, width;
@ -2397,7 +2397,7 @@ int port;
port); port);
#if USER_SPACE #if USER_SPACE
if (OK != (s=sys_outl(PCII_CONFADD, PCII_UNSEL))) if (OK != (s=sys_outl(PCII_CONFADD, PCII_UNSEL)))
printf("PCI: warning, sys_outl failed: %d\n"); printf("PCI: warning, sys_outl failed: %d\n", s);
#else #else
outl(PCII_CONFADD, PCII_UNSEL); outl(PCII_CONFADD, PCII_UNSEL);
#endif #endif
@ -2514,7 +2514,7 @@ u32_t value;
port, value); port, value);
#if USER_SPACE #if USER_SPACE
if (OK != (s=sys_outl(PCII_CONFADD, PCII_UNSEL))) if (OK != (s=sys_outl(PCII_CONFADD, PCII_UNSEL)))
printf("PCI: warning, sys_outl failed: %d\n"); printf("PCI: warning, sys_outl failed: %d\n",s);
#else #else
outl(PCII_CONFADD, PCII_UNSEL); outl(PCII_CONFADD, PCII_UNSEL);
#endif #endif
@ -2523,8 +2523,7 @@ u32_t value;
/*===========================================================================* /*===========================================================================*
* pcii_rsts * * pcii_rsts *
*===========================================================================*/ *===========================================================================*/
PRIVATE u16_t pcii_rsts(busind) PRIVATE u16_t pcii_rsts(int busind)
int busind;
{ {
u16_t v; u16_t v;
int s; int s;

View File

@ -263,7 +263,7 @@ _PROTOTYPE( static void check_int_events, (void) );
_PROTOTYPE( static void do_hard_int, (void) ); _PROTOTYPE( static void do_hard_int, (void) );
_PROTOTYPE( static void rtl8169_dump, (void) ); _PROTOTYPE( static void rtl8169_dump, (void) );
_PROTOTYPE( static void dump_phy, (re_t *rep) ); _PROTOTYPE( static void dump_phy, (re_t *rep) );
_PROTOTYPE( static int rl_handler, (re_t *rep) ); _PROTOTYPE( static void rl_handler, (re_t *rep) );
_PROTOTYPE( static void rl_watchdog_f, (timer_t *tp) ); _PROTOTYPE( static void rl_watchdog_f, (timer_t *tp) );
/* /*
@ -1989,8 +1989,7 @@ static void do_hard_int(void)
/*===========================================================================* /*===========================================================================*
* rl_handler * * rl_handler *
*===========================================================================*/ *===========================================================================*/
static int rl_handler(rep) static void rl_handler(re_t *rep)
re_t *rep;
{ {
int i, port, tx_head, tx_tail, link_up; int i, port, tx_head, tx_tail, link_up;
u16_t isr; u16_t isr;
@ -2093,8 +2092,6 @@ re_t *rep;
if (isr) if (isr)
printf("rl_handler: unhandled interrupt isr = 0x%04x\n", isr); printf("rl_handler: unhandled interrupt isr = 0x%04x\n", isr);
return 1;
} }
/*===========================================================================* /*===========================================================================*

View File

@ -328,10 +328,10 @@ PRIVATE int get_set_input(const message *m_ptr, int flag, int channel)
mixer_set(input_cmd, mask); mixer_set(input_cmd, mask);
} else { /* Get input */ } else { /* Get input */
if (shift > 0) { if (shift > 0) {
input.left = (((mask >> (shift+1)) & 1) == 1 ? ON : OFF); input.left = ((((mask >> (shift+1)) & 1) == 1) ? ON : OFF);
input.right = (((mask >> shift) & 1) == 1 ? ON : OFF); input.right = ((((mask >> shift) & 1) == 1) ? ON : OFF);
} else { } else {
input.left = ((mask & 1) == 1 ? ON : OFF); input.left = (((mask & 1) == 1) ? ON : OFF);
} }
/* Copy back to user */ /* Copy back to user */
@ -384,10 +384,10 @@ PRIVATE int get_set_output(const message *m_ptr, int flag)
mixer_set(MIXER_OUTPUT_CTRL, mask); mixer_set(MIXER_OUTPUT_CTRL, mask);
} else { /* Get input */ } else { /* Get input */
if (shift > 0) { if (shift > 0) {
output.left = (((mask >> (shift+1)) & 1) == 1 ? ON : OFF); output.left = ((((mask >> (shift+1)) & 1) == 1) ? ON : OFF);
output.right = (((mask >> shift) & 1) == 1 ? ON : OFF); output.right = ((((mask >> shift) & 1) == 1) ? ON : OFF);
} else { } else {
output.left = ((mask & 1) == 1 ? ON : OFF); output.left = (((mask & 1) == 1) ? ON : OFF);
} }
/* Copy back to user */ /* Copy back to user */

View File

@ -440,7 +440,7 @@ struct port *pp;
v8= pci_attr_r8(devind, TI_CARD_CTRL); v8= pci_attr_r8(devind, TI_CARD_CTRL);
if (v8 & TI_CCR_IFG) if (v8 & TI_CCR_IFG)
{ {
printf("ti1225: got functional interrupt\n", v8); printf("ti1225: got functional interrupt\n");
pci_attr_w8(devind, TI_CARD_CTRL, v8); pci_attr_w8(devind, TI_CARD_CTRL, v8);
} }

View File

@ -49,7 +49,7 @@ printf("ld_dr7(0x%x)\n",dr7);
case 3: ld_dr3(linaddr); break; case 3: ld_dr3(linaddr); break;
default: panic(__FILE__, "invalid breakpoint index", __LINE__); default: panic(__FILE__, "invalid breakpoint index", __LINE__);
} }
printf("ld_dr%d(0x%x, 0x%x)\n",bp,linaddr); printf("ld_dr%d(0x%x)\n",bp,linaddr);
/* set new flags */ /* set new flags */
dr7 |= dr7flags; dr7 |= dr7flags;

View File

@ -32,7 +32,7 @@ PUBLIC int do_clear(struct proc * caller, message * m_ptr)
rc = proc_addr(exit_p); /* clean up */ rc = proc_addr(exit_p); /* clean up */
/* Don't clear if already cleared. */ /* Don't clear if already cleared. */
if(isemptyp(rc)) return; if(isemptyp(rc)) return OK;
/* Check the table with IRQ hooks to see if hooks should be released. */ /* Check the table with IRQ hooks to see if hooks should be released. */
for (i=0; i < NR_IRQ_HOOKS; i++) { for (i=0; i < NR_IRQ_HOOKS; i++) {

View File

@ -35,14 +35,12 @@ PUBLIC int do_update(struct proc * caller, message * m_ptr)
*/ */
endpoint_t src_e, dst_e; endpoint_t src_e, dst_e;
int src_p, dst_p; int src_p, dst_p;
struct proc *src_rp, *dst_rp, *rp; struct proc *src_rp, *dst_rp;
struct priv *src_privp, *dst_privp; struct priv *src_privp, *dst_privp;
struct proc orig_src_proc; struct proc orig_src_proc;
struct proc orig_dst_proc; struct proc orig_dst_proc;
struct priv orig_src_priv; struct priv orig_src_priv;
struct priv orig_dst_priv; struct priv orig_dst_priv;
int r;
reg_t src_vbp, dst_vbp;
/* Lookup slots for source and destination process. */ /* Lookup slots for source and destination process. */
src_e = m_ptr->SYS_UPD_SRC_ENDPT; src_e = m_ptr->SYS_UPD_SRC_ENDPT;

View File

@ -21,7 +21,6 @@ PUBLIC int do_vmctl(struct proc * caller, message * m_ptr)
int proc_nr; int proc_nr;
endpoint_t ep = m_ptr->SVMCTL_WHO; endpoint_t ep = m_ptr->SVMCTL_WHO;
struct proc *p, *rp, *target; struct proc *p, *rp, *target;
int err;
if(ep == SELF) { ep = m_ptr->m_source; } if(ep == SELF) { ep = m_ptr->m_source; }

View File

@ -206,7 +206,7 @@ date_of(const register struct dsttype *dst, const struct tm *timep)
if (dst->ds_type != 'M') { if (dst->ds_type != 'M') {
return dst->ds_date[0] - return dst->ds_date[0] -
(dst->ds_type == 'J' ((dst->ds_type == 'J')
&& leap && leap
&& dst->ds_date[0] < 58); && dst->ds_date[0] < 58);
} }

View File

@ -385,7 +385,7 @@ message *mp;
/*===========================================================================* /*===========================================================================*
* nop_prepare * * nop_prepare *
*===========================================================================*/ *===========================================================================*/
PUBLIC struct device *nop_prepare(device) PUBLIC struct device *nop_prepare(int device)
{ {
/* Nothing to prepare for. */ /* Nothing to prepare for. */
return(NIL_DEV); return(NIL_DEV);

View File

@ -92,9 +92,6 @@ sef_init_info_t *info;
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_cb_signal_handler(int signo) PRIVATE void sef_cb_signal_handler(int signo)
{ {
sigset_t set;
int r;
/* Only check for termination signal, ignore anything else. */ /* Only check for termination signal, ignore anything else. */
if (signo != SIGTERM) return; if (signo != SIGTERM) return;

View File

@ -61,8 +61,7 @@ PUBLIC struct boot_image image[NR_BOOT_PROCS];
PUBLIC void timing_dmp() PUBLIC void timing_dmp()
{ {
static struct util_timingdata timingdata[TIMING_CATEGORIES]; static struct util_timingdata timingdata[TIMING_CATEGORIES];
int r, c, f, skipped = 0, printed = 0, maxlines = 23, x = 0; int r, c, x = 0;
static int offsetlines = 0;
if ((r = sys_getlocktimings(&timingdata[0])) != OK) { if ((r = sys_getlocktimings(&timingdata[0])) != OK) {
printf("IS: warning: couldn't get copy of lock timings: %d\n", r); printf("IS: warning: couldn't get copy of lock timings: %d\n", r);
@ -213,7 +212,7 @@ PRIVATE char *boot_flags_str(int flags)
*===========================================================================*/ *===========================================================================*/
PUBLIC void image_dmp() PUBLIC void image_dmp()
{ {
int m, i,j,r; int m, r;
struct boot_image *ip; struct boot_image *ip;
if ((r = sys_getimage(image)) != OK) { if ((r = sys_getimage(image)) != OK) {
@ -315,7 +314,7 @@ PUBLIC void privileges_dmp()
register struct proc *rp; register struct proc *rp;
static struct proc *oldrp = BEG_PROC_ADDR; static struct proc *oldrp = BEG_PROC_ADDR;
register struct priv *sp; register struct priv *sp;
int r, i, n = 0; int r, i;
/* First obtain a fresh copy of the current process and system table. */ /* First obtain a fresh copy of the current process and system table. */
if ((r = sys_getprivtab(priv)) != OK) { if ((r = sys_getprivtab(priv)) != OK) {
@ -381,7 +380,7 @@ PUBLIC void proctab_dmp()
register struct proc *rp; register struct proc *rp;
static struct proc *oldrp = BEG_PROC_ADDR; static struct proc *oldrp = BEG_PROC_ADDR;
int r, n = 0; int r;
phys_clicks text, data, size; phys_clicks text, data, size;
/* First obtain a fresh copy of the current process table. */ /* First obtain a fresh copy of the current process table. */
@ -418,7 +417,7 @@ PUBLIC void procstack_dmp()
register struct proc *rp; register struct proc *rp;
static struct proc *oldrp = BEG_PROC_ADDR; static struct proc *oldrp = BEG_PROC_ADDR;
int r, n = 0; int r;
/* First obtain a fresh copy of the current process table. */ /* First obtain a fresh copy of the current process table. */
if ((r = sys_getproctab(proc)) != OK) { if ((r = sys_getproctab(proc)) != OK) {
@ -441,7 +440,7 @@ PUBLIC void memmap_dmp()
{ {
register struct proc *rp; register struct proc *rp;
static struct proc *oldrp = proc; static struct proc *oldrp = proc;
int r, n = 0; int r;
phys_clicks size; phys_clicks size;
/* First obtain a fresh copy of the current process table. */ /* First obtain a fresh copy of the current process table. */

View File

@ -37,7 +37,6 @@ PUBLIC int main(int argc, char **argv)
* sending the reply. The loop never terminates, unless a panic occurs. * sending the reply. The loop never terminates, unless a panic occurs.
*/ */
int result; int result;
sigset_t sigset;
/* SEF local startup. */ /* SEF local startup. */
env_setargs(argc, argv); env_setargs(argc, argv);
@ -97,7 +96,7 @@ PRIVATE void sef_local_startup()
/*===========================================================================* /*===========================================================================*
* sef_cb_init_fresh * * sef_cb_init_fresh *
*===========================================================================*/ *===========================================================================*/
PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{ {
/* Initialize the information server. */ /* Initialize the information server. */

View File

@ -28,7 +28,6 @@ PUBLIC struct buf *bp_to_pickup = buf; /* This is a pointer to the next node in
PUBLIC struct buf *get_block(block) PUBLIC struct buf *get_block(block)
register block_t block; /* which block is wanted? */ register block_t block; /* which block is wanted? */
{ {
int b;
register struct buf *bp, *free_bp; register struct buf *bp, *free_bp;
free_bp = NIL_BUF; free_bp = NIL_BUF;

View File

@ -41,7 +41,6 @@ void **buf;
int *vec_grants; int *vec_grants;
vir_bytes bytes; vir_bytes bytes;
{ {
int size;
int j; int j;
iovec_t *v; iovec_t *v;
static iovec_t new_iovec[NR_IOREQS]; static iovec_t new_iovec[NR_IOREQS];
@ -170,10 +169,8 @@ int bytes; /* how many bytes to transfer */
int flags; /* special flags, like O_NONBLOCK */ int flags; /* special flags, like O_NONBLOCK */
{ {
/* Read or write from a device. The parameter 'dev' tells which one. */ /* Read or write from a device. The parameter 'dev' tells which one. */
struct dmap *dp;
int r, safe; int r, safe;
message m; message m;
iovec_t *v;
cp_grant_id_t gid = GRANT_INVALID; cp_grant_id_t gid = GRANT_INVALID;
int vec_grants; int vec_grants;
int op_used; int op_used;

View File

@ -20,7 +20,6 @@ FORWARD _PROTOTYPE( int sef_cb_init_fresh, (int type, sef_init_info_t *info) );
*===========================================================================*/ *===========================================================================*/
PUBLIC int main(void) { PUBLIC int main(void) {
endpoint_t who_e, ind, error; endpoint_t who_e, ind, error;
message m;
/* SEF local startup. */ /* SEF local startup. */
sef_local_startup(); sef_local_startup();

View File

@ -16,7 +16,7 @@ FORWARD _PROTOTYPE( int parse_path, (ino_t dir_ino, ino_t root_ino, int flags,
*===========================================================================*/ *===========================================================================*/
PUBLIC int fs_lookup() { PUBLIC int fs_lookup() {
cp_grant_id_t grant; cp_grant_id_t grant;
int r, r1, len, flags; int r, len, flags;
size_t offset; size_t offset;
ino_t dir_ino, root_ino; ino_t dir_ino, root_ino;
struct dir_record *dir; struct dir_record *dir;
@ -87,8 +87,8 @@ PUBLIC int search_dir(ldir_ptr,string,numb)
ino_t *numb; /* pointer to new dir record */ ino_t *numb; /* pointer to new dir record */
{ {
struct dir_record *dir_tmp; struct dir_record *dir_tmp;
register struct buf *bp,*bp2; register struct buf *bp;
int pos,len; int pos;
char* comma_pos = NULL; char* comma_pos = NULL;
char tmp_string[NAME_MAX]; char tmp_string[NAME_MAX];
@ -293,8 +293,7 @@ struct dir_record **resp; /* resulting inode */
*/ */
register struct dir_record *rip = NULL; register struct dir_record *rip = NULL;
int r, inumb; int r;
dev_t mnt_dev;
ino_t numb; ino_t numb;
/* If 'string' is empty, yield same inode straight away. */ /* If 'string' is empty, yield same inode straight away. */

View File

@ -80,8 +80,7 @@ PUBLIC int fs_bread(void)
int nrbytes; int nrbytes;
u64_t position; u64_t position;
unsigned int off, cum_io; unsigned int off, cum_io;
mode_t mode_word; int completed;
int completed, r2 = OK;
struct dir_record *dir; struct dir_record *dir;
r = OK; r = OK;
@ -292,9 +291,7 @@ int *completed; /* number of bytes copied */
register struct buf *bp; register struct buf *bp;
register int r = OK; register int r = OK;
int n;
block_t b; block_t b;
dev_t dev;
int file_unit, rel_block, offset; int file_unit, rel_block, offset;
*completed = 0; *completed = 0;

View File

@ -25,8 +25,7 @@ PRIVATE int stat_dir_record(
/* Common code for stat and fstat system calls. */ /* Common code for stat and fstat system calls. */
struct stat statbuf; struct stat statbuf;
mode_t mo; int r;
int r, s;
struct tm ltime; struct tm ltime;
time_t time1; time_t time1;

View File

@ -54,7 +54,6 @@ void **buf;
int *vec_grants; int *vec_grants;
vir_bytes bytes; vir_bytes bytes;
{ {
int access = 0, size;
int j; int j;
iovec_t *v; iovec_t *v;
static iovec_t *new_iovec; static iovec_t *new_iovec;
@ -158,10 +157,8 @@ int bytes; /* how many bytes to transfer */
int flags; /* special flags, like O_NONBLOCK */ int flags; /* special flags, like O_NONBLOCK */
{ {
/* Read or write from a device. The parameter 'dev' tells which one. */ /* Read or write from a device. The parameter 'dev' tells which one. */
struct dmap *dp;
int r, safe; int r, safe;
message m; message m;
iovec_t *v;
cp_grant_id_t gid = GRANT_INVALID; cp_grant_id_t gid = GRANT_INVALID;
int vec_grants; int vec_grants;
int op_used; int op_used;

View File

@ -128,7 +128,7 @@ int numb; /* inode number (ANSI: may not be unshort) */
/* Find the inode in the hash table. If it is not there, get a free inode /* Find the inode in the hash table. If it is not there, get a free inode
* load it from the disk if it's necessary and put on the hash list * load it from the disk if it's necessary and put on the hash list
*/ */
register struct inode *rip, *xp; register struct inode *rip;
int hashi; int hashi;
hashi = numb & INODE_HASH_MASK; hashi = numb & INODE_HASH_MASK;

View File

@ -28,7 +28,6 @@ PUBLIC int main(int argc, char *argv[])
* sending the reply. The loop never terminates, unless a panic occurs. * sending the reply. The loop never terminates, unless a panic occurs.
*/ */
int error, ind; int error, ind;
message m;
/* SEF local startup. */ /* SEF local startup. */
env_setargs(argc, argv); env_setargs(argc, argv);

View File

@ -23,7 +23,6 @@ PUBLIC int fs_readsuper()
* so that the VFS knows that it has to find the vnode on which this FS * so that the VFS knows that it has to find the vnode on which this FS
* process' partition is mounted on. * process' partition is mounted on.
*/ */
struct super_block *xp;
struct inode *root_ip; struct inode *root_ip;
cp_grant_id_t label_gid; cp_grant_id_t label_gid;
size_t label_len; size_t label_len;
@ -152,7 +151,6 @@ PUBLIC int fs_mountpoint()
PUBLIC int fs_unmount() PUBLIC int fs_unmount()
{ {
/* Unmount a file system by device number. */ /* Unmount a file system by device number. */
struct super_block *sp1;
int count; int count;
struct inode *rip, *root_ip; struct inode *rip, *root_ip;

View File

@ -21,7 +21,7 @@ FORWARD _PROTOTYPE( struct inode *new_node, (struct inode *ldirp,
PUBLIC int fs_create() PUBLIC int fs_create()
{ {
phys_bytes len; phys_bytes len;
int r, b; int r;
struct inode *ldirp; struct inode *ldirp;
struct inode *rip; struct inode *rip;
mode_t omode; mode_t omode;

View File

@ -67,7 +67,6 @@ PUBLIC int fs_lookup()
if(user_path[len - 1] != '\0') return(EINVAL); if(user_path[len - 1] != '\0') return(EINVAL);
if(flags & PATH_GET_UCRED) { /* Do we have to copy uid/gid credentials? */ if(flags & PATH_GET_UCRED) { /* Do we have to copy uid/gid credentials? */
int i;
grant2 = fs_m_in.REQ_GRANT2; grant2 = fs_m_in.REQ_GRANT2;
cred_size = fs_m_in.REQ_UCRED_SIZE; cred_size = fs_m_in.REQ_UCRED_SIZE;

View File

@ -17,7 +17,6 @@ PUBLIC int fs_chmod()
/* Perform the chmod(name, mode) system call. */ /* Perform the chmod(name, mode) system call. */
register struct inode *rip; register struct inode *rip;
register int r;
/* Temporarily open the file. */ /* Temporarily open the file. */
if( (rip = get_inode(fs_dev, fs_m_in.REQ_INODE_NR)) == NIL_INODE) if( (rip = get_inode(fs_dev, fs_m_in.REQ_INODE_NR)) == NIL_INODE)
@ -78,7 +77,6 @@ PUBLIC int forbidden(register struct inode *rip, mode_t access_desired)
*/ */
register struct inode *old_rip = rip; register struct inode *old_rip = rip;
register struct super_block *sp;
register mode_t bits, perm_bits; register mode_t bits, perm_bits;
int r, shift; int r, shift;

View File

@ -22,7 +22,7 @@ PRIVATE char getdents_buf[GETDENTS_BUFSIZ];
PUBLIC int fs_readwrite(void) PUBLIC int fs_readwrite(void)
{ {
int r, rw_flag, chunk, block_size, block_spec; int r, rw_flag, chunk, block_size, block_spec;
int partial_cnt, regular, nrbytes; int regular, nrbytes;
cp_grant_id_t gid; cp_grant_id_t gid;
off_t position, f_size, bytes_left; off_t position, f_size, bytes_left;
unsigned int off, cum_io; unsigned int off, cum_io;
@ -140,8 +140,7 @@ PUBLIC int fs_breadwrite(void)
int nrbytes; int nrbytes;
u64_t position; u64_t position;
unsigned int off, cum_io; unsigned int off, cum_io;
mode_t mode_word; int completed;
int completed, r2 = OK;
/* Pseudo inode for rw_chunk */ /* Pseudo inode for rw_chunk */
struct inode rip; struct inode rip;

View File

@ -291,7 +291,6 @@ off_t position; /* file pointer */
zone_t z; zone_t z;
zone_t zone_size; zone_t zone_size;
int scale, r; int scale, r;
struct super_block *sp;
/* Is another block available in the current zone? */ /* Is another block available in the current zone? */
if ( (b = read_map(rip, position)) == NO_BLOCK) { if ( (b = read_map(rip, position)) == NO_BLOCK) {

View File

@ -127,7 +127,7 @@ int numb; /* inode number (ANSI: may not be unshort) */
/* Find the inode in the hash table. If it is not there, get a free inode /* Find the inode in the hash table. If it is not there, get a free inode
* load it from the disk if it's necessary and put on the hash list * load it from the disk if it's necessary and put on the hash list
*/ */
register struct inode *rip, *xp; register struct inode *rip;
int hashi; int hashi;
hashi = numb & INODE_HASH_MASK; hashi = numb & INODE_HASH_MASK;
@ -245,7 +245,6 @@ PUBLIC struct inode *alloc_inode(dev_t dev, mode_t bits)
/* Allocate a free inode on 'dev', and return a pointer to it. */ /* Allocate a free inode on 'dev', and return a pointer to it. */
register struct inode *rip; register struct inode *rip;
int major, minor;
bit_t b; bit_t b;
ino_t i_num; ino_t i_num;
@ -293,8 +292,6 @@ register struct inode *rip; /* the inode to be erased */
* inode is to be truncated. * inode is to be truncated.
*/ */
register int i;
rip->i_size = 0; rip->i_size = 0;
rip->i_update = ATIME | CTIME | MTIME; /* update all times later */ rip->i_update = ATIME | CTIME | MTIME; /* update all times later */
} }

View File

@ -1,8 +1,5 @@
#include "fs.h" #include "fs.h"
#include <sys/stat.h>
#include <string.h> #include <string.h>
#include <minix/com.h>
#include <minix/callnr.h>
#include "buf.h" #include "buf.h"
#include "inode.h" #include "inode.h"
#include <minix/vfsif.h> #include <minix/vfsif.h>
@ -14,7 +11,6 @@ PUBLIC int fs_ftrunc(void)
{ {
struct inode *rip; struct inode *rip;
off_t start, end; off_t start, end;
int r;
ino_t inumb; ino_t inumb;
inumb = fs_m_in.REQ_INODE_NR; inumb = fs_m_in.REQ_INODE_NR;
@ -43,7 +39,6 @@ off_t newsize; /* inode must become this size */
* O_APPEND mode, as this is different per fd and is checked when * O_APPEND mode, as this is different per fd and is checked when
* writing is done. * writing is done.
*/ */
int scale;
/* Pipes can shrink, so adjust size to make sure all zones are removed. */ /* Pipes can shrink, so adjust size to make sure all zones are removed. */
if(newsize != 0) return(EINVAL); /* Only truncate pipes to 0. */ if(newsize != 0) return(EINVAL); /* Only truncate pipes to 0. */

View File

@ -25,7 +25,6 @@ PUBLIC int main(int argc, char *argv[])
* sending the reply. The loop never terminates, unless a panic occurs. * sending the reply. The loop never terminates, unless a panic occurs.
*/ */
int error, ind; int error, ind;
message m;
/* SEF local startup. */ /* SEF local startup. */
env_setargs(argc, argv); env_setargs(argc, argv);

View File

@ -12,7 +12,6 @@
PUBLIC int fs_readwrite(void) PUBLIC int fs_readwrite(void)
{ {
int r, rw_flag; int r, rw_flag;
block_t b;
struct buf *bp; struct buf *bp;
cp_grant_id_t gid; cp_grant_id_t gid;
off_t position, f_size; off_t position, f_size;

View File

@ -40,7 +40,6 @@
PUBLIC int do_exec() PUBLIC int do_exec()
{ {
message m; message m;
int r;
/* Forward call to FS */ /* Forward call to FS */
m.m_type = PM_EXEC; m.m_type = PM_EXEC;

View File

@ -47,7 +47,7 @@ PUBLIC int do_fork()
register struct mproc *rmc; /* pointer to child */ register struct mproc *rmc; /* pointer to child */
pid_t new_pid; pid_t new_pid;
static int next_child; static int next_child;
int i, n = 0, r, s; int i, n = 0, s;
endpoint_t child_ep; endpoint_t child_ep;
message m; message m;
@ -133,7 +133,7 @@ PUBLIC int do_srv_fork()
int s; int s;
pid_t new_pid; pid_t new_pid;
static int next_child; static int next_child;
int i, n = 0, r; int i, n = 0;
endpoint_t child_ep; endpoint_t child_ep;
message m; message m;
@ -243,7 +243,7 @@ int dump_core; /* flag indicating whether to dump core */
* become a zombie. * become a zombie.
*/ */
register int proc_nr, proc_nr_e; register int proc_nr, proc_nr_e;
int parent_waiting, r; int r;
pid_t procgrp; pid_t procgrp;
struct mproc *p_mp; struct mproc *p_mp;
clock_t user_time, sys_time; clock_t user_time, sys_time;

View File

@ -22,7 +22,7 @@ PUBLIC int do_get()
*/ */
register struct mproc *rmp = mp; register struct mproc *rmp = mp;
int r, proc; int r;
int ngroups; int ngroups;
switch(call_nr) { switch(call_nr) {

View File

@ -366,7 +366,6 @@ PUBLIC int do_getepinfo()
PUBLIC int do_reboot() PUBLIC int do_reboot()
{ {
message m; message m;
int r;
/* Check permission to abort the system. */ /* Check permission to abort the system. */
if (mp->mp_effuid != SUPER_USER) return(EPERM); if (mp->mp_effuid != SUPER_USER) return(EPERM);

View File

@ -213,9 +213,7 @@ PUBLIC int do_srv_kill()
/*===========================================================================* /*===========================================================================*
* process_ksig * * process_ksig *
*===========================================================================*/ *===========================================================================*/
PUBLIC int process_ksig(proc_nr_e, signo) PUBLIC int process_ksig(int proc_nr_e, int signo)
int proc_nr_e;
int signo;
{ {
register struct mproc *rmp; register struct mproc *rmp;
int proc_nr; int proc_nr;
@ -223,14 +221,14 @@ int signo;
if(pm_isokendpt(proc_nr_e, &proc_nr) != OK || proc_nr < 0) { if(pm_isokendpt(proc_nr_e, &proc_nr) != OK || proc_nr < 0) {
printf("PM: process_ksig: %d?? not ok\n", proc_nr_e); printf("PM: process_ksig: %d?? not ok\n", proc_nr_e);
return; return EDEADSRCDST; /* process is gone. */
} }
rmp = &mproc[proc_nr]; rmp = &mproc[proc_nr];
if ((rmp->mp_flags & (IN_USE | EXITING)) != IN_USE) { if ((rmp->mp_flags & (IN_USE | EXITING)) != IN_USE) {
#if 0 #if 0
printf("PM: process_ksig: %d?? exiting / not in use\n", proc_nr_e); printf("PM: process_ksig: %d?? exiting / not in use\n", proc_nr_e);
#endif #endif
return; return EDEADSRCDST; /* process is gone. */
} }
proc_id = rmp->mp_pid; proc_id = rmp->mp_pid;
mp = &mproc[0]; /* pretend signals are from PM */ mp = &mproc[0]; /* pretend signals are from PM */
@ -615,7 +613,7 @@ struct mproc *rmp; /* which process */
* so it can check for READs and WRITEs from pipes, ttys and the like. * so it can check for READs and WRITEs from pipes, ttys and the like.
*/ */
message m; message m;
int r, slot; int r;
/* If we're already waiting for a delayed call, don't do anything now. */ /* If we're already waiting for a delayed call, don't do anything now. */
if (rmp->mp_flags & DELAY_CALL) if (rmp->mp_flags & DELAY_CALL)

View File

@ -34,7 +34,6 @@ int srv_execve(int proc_e, char *exec, size_t exec_len, char **argv,
size_t string_off; size_t string_off;
size_t n; size_t n;
int ov; int ov;
message m;
int r; int r;
/* Assumptions: size_t and char *, it's all the same thing. */ /* Assumptions: size_t and char *, it's all the same thing. */
@ -161,7 +160,7 @@ static int do_exec(int proc_e, char *exec, size_t exec_len, char *progname,
proc_e, (vir_bytes) vsp, (phys_bytes)frame_len); proc_e, (vir_bytes) vsp, (phys_bytes)frame_len);
if (r != OK) { if (r != OK) {
printf("RS: stack_top is 0x%lx; tried to copy to 0x%lx in %d\n", printf("RS: stack_top is 0x%lx; tried to copy to 0x%lx in %d\n",
stack_top, vsp); stack_top, vsp, proc_e);
printf("do_exec: copying out new stack failed: %d\n", r); printf("do_exec: copying out new stack failed: %d\n", r);
error= r; error= r;
goto fail; goto fail;
@ -298,7 +297,6 @@ vir_bytes *pc; /* program entry point (initial PC) */
int *hdrlenp; int *hdrlenp;
{ {
/* Read the header and extract the text, data, bss and total sizes from it. */ /* Read the header and extract the text, data, bss and total sizes from it. */
block_t b;
struct exec hdr; /* a.out header is read in here */ struct exec hdr; /* a.out header is read in here */
/* Read the header and check the magic number. The standard MINIX header /* Read the header and check the magic number. The standard MINIX header
@ -327,8 +325,6 @@ int *hdrlenp;
* used here only. The symbol table is for the benefit of a debugger and * used here only. The symbol table is for the benefit of a debugger and
* is ignored here. * is ignored here.
*/ */
int r;
if (exec_len < sizeof(hdr)) return(ENOEXEC); if (exec_len < sizeof(hdr)) return(ENOEXEC);
memcpy(&hdr, exec, sizeof(hdr)); memcpy(&hdr, exec, sizeof(hdr));
@ -413,7 +409,6 @@ phys_bytes seg_bytes; /* how much is to be transferred? */
*/ */
int r; int r;
off_t n, o, b_off, seg_off;
if (off+seg_bytes > exec_len) return ENOEXEC; if (off+seg_bytes > exec_len) return ENOEXEC;
r= sys_vircopy(SELF, D, (vir_bytes)exec+off, proc_e, seg, 0, seg_bytes); r= sys_vircopy(SELF, D, (vir_bytes)exec+off, proc_e, seg, 0, seg_bytes);

View File

@ -479,8 +479,6 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_cb_signal_handler(int signo) PRIVATE void sef_cb_signal_handler(int signo)
{ {
int exit_status;
/* Check for known signals, ignore anything else. */ /* Check for known signals, ignore anything else. */
switch(signo) { switch(signo) {
case SIGCHLD: case SIGCHLD:
@ -508,13 +506,15 @@ PRIVATE int sef_cb_signal_manager(endpoint_t target, int signo)
if(rs_verbose) if(rs_verbose)
printf("RS: ignoring spurious signal %d for process %d\n", printf("RS: ignoring spurious signal %d for process %d\n",
signo, target); signo, target);
return; return OK; /* Since we're ignoring it, we have handled
* the signal without problem. All is OK.
*/
} }
rp = rproc_ptr[target_p]; rp = rproc_ptr[target_p];
rpub = rp->r_pub; rpub = rp->r_pub;
/* Don't bother if a termination signal has already been processed. */ /* Don't bother if a termination signal has already been processed. */
if( rp->r_flags & (RS_TERMINATED|RS_EXITING) == RS_TERMINATED ) { if(rp->r_flags & RS_TERMINATED) {
return EDEADSRCDST; /* process is gone */ return EDEADSRCDST; /* process is gone */
} }

View File

@ -268,7 +268,6 @@ PUBLIC void end_update(int result)
* service has a period, a status request will be forced in the next period. * service has a period, a status request will be forced in the next period.
*/ */
struct rproc *old_rp, *new_rp, *exiting_rp, *surviving_rp; struct rproc *old_rp, *new_rp, *exiting_rp, *surviving_rp;
message m;
old_rp = rupdate.rp; old_rp = rupdate.rp;
new_rp = old_rp->r_new_rp; new_rp = old_rp->r_new_rp;
@ -316,8 +315,6 @@ char *errstr;
int err; int err;
{ {
/* Crash a system service and don't let it restart. */ /* Crash a system service and don't let it restart. */
struct rprocpub *rpub;
if(errstr && !shutting_down) { if(errstr && !shutting_down) {
printf("RS: %s (error %d)\n", errstr, err); printf("RS: %s (error %d)\n", errstr, err);
} }
@ -383,12 +380,8 @@ struct rproc *rp;
/* Create the given system service. */ /* Create the given system service. */
int child_proc_nr_e, child_proc_nr_n; /* child process slot */ int child_proc_nr_e, child_proc_nr_n; /* child process slot */
pid_t child_pid; /* child's process id */ pid_t child_pid; /* child's process id */
char *file_only; int s, use_copy;
int s, use_copy, slot_nr;
bitchunk_t *vm_mask;
message m;
extern char **environ; extern char **environ;
char * null_env = NULL;
struct rprocpub *rpub; struct rprocpub *rpub;
rpub = rp->r_pub; rpub = rp->r_pub;
@ -879,11 +872,63 @@ PUBLIC void terminate_service(struct rproc *rp)
} }
} }
/*===========================================================================*
* run_script *
*===========================================================================*/
PRIVATE int run_script(struct rproc *rp)
{
int r, endpoint;
pid_t pid;
char *reason;
char incarnation_str[20]; /* Enough for a counter? */
char *envp[1] = { NULL };
struct rprocpub *rpub;
rpub = rp->r_pub;
if (rp->r_flags & RS_REFRESHING)
reason= "restart";
else if (rp->r_flags & RS_NOPINGREPLY)
reason= "no-heartbeat";
else reason= "crashed";
sprintf(incarnation_str, "%d", rp->r_restarts);
if(rs_verbose) {
printf("RS: %s:\n", srv_to_string(rp));
printf("RS: calling script '%s'\n", rp->r_script);
printf("RS: reason: '%s'\n", reason);
printf("RS: incarnation: '%s'\n", incarnation_str);
}
pid= fork();
switch(pid)
{
case -1:
return kill_service(rp, "unable to fork script", errno);
case 0:
execle(rp->r_script, rp->r_script, rpub->label, reason,
incarnation_str, NULL, envp);
printf("RS: run_script: execl '%s' failed: %s\n",
rp->r_script, strerror(errno));
exit(1);
default:
/* Set the privilege structure for the child process. */
endpoint = getnprocnr(pid);
if ((r = sys_privctl(endpoint, SYS_PRIV_SET_USER, NULL))
!= OK) {
return kill_service(rp,"can't set script privileges",r);
}
/* Allow the script to run. */
if ((r = sys_privctl(endpoint, SYS_PRIV_ALLOW, NULL)) != OK) {
return kill_service(rp,"can't let the script run",r);
}
}
return OK;
}
/*===========================================================================* /*===========================================================================*
* restart_service * * restart_service *
*===========================================================================*/ *===========================================================================*/
PUBLIC void restart_service(rp) PUBLIC void restart_service(struct rproc *rp)
struct rproc *rp;
{ {
/* Restart service via a recovery script or directly. */ /* Restart service via a recovery script or directly. */
struct rproc *replica_rp; struct rproc *replica_rp;
@ -1092,13 +1137,7 @@ endpoint_t source;
{ {
/* Initialize a slot as requested by the client. */ /* Initialize a slot as requested by the client. */
struct rprocpub *rpub; struct rprocpub *rpub;
int slot_nr; /* local table entry */
int arg_count; /* number of arguments */
char *cmd_ptr; /* parse command string */
char *label; /* unique name of command */ char *label; /* unique name of command */
enum dev_style dev_style; /* device style */
struct rproc *tmp_rp;
struct rprocpub *tmp_rpub;
int len; /* length of string */ int len; /* length of string */
int i; int i;
int s; int s;
@ -1534,59 +1573,6 @@ struct rproc *rp;
rproc_ptr[_ENDPOINT_P(rpub->endpoint)] = NULL; rproc_ptr[_ENDPOINT_P(rpub->endpoint)] = NULL;
} }
/*===========================================================================*
* run_script *
*===========================================================================*/
PUBLIC int run_script(rp)
struct rproc *rp;
{
int r, endpoint;
pid_t pid;
char *reason;
char incarnation_str[20]; /* Enough for a counter? */
char *envp[1] = { NULL };
struct rprocpub *rpub;
rpub = rp->r_pub;
if (rp->r_flags & RS_REFRESHING)
reason= "restart";
else if (rp->r_flags & RS_NOPINGREPLY)
reason= "no-heartbeat";
else reason= "crashed";
sprintf(incarnation_str, "%d", rp->r_restarts);
if(rs_verbose) {
printf("RS: %s:\n", srv_to_string(rp));
printf("RS: calling script '%s'\n", rp->r_script);
printf("RS: reason: '%s'\n", reason);
printf("RS: incarnation: '%s'\n", incarnation_str);
}
pid= fork();
switch(pid)
{
case -1:
return kill_service(rp, "unable to fork script", errno);
case 0:
execle(rp->r_script, rp->r_script, rpub->label, reason,
incarnation_str, NULL, envp);
printf("RS: run_script: execl '%s' failed: %s\n",
rp->r_script, strerror(errno));
exit(1);
default:
/* Set the privilege structure for the child process. */
endpoint = getnprocnr(pid);
if ((r = sys_privctl(endpoint, SYS_PRIV_SET_USER, NULL))
!= OK) {
return kill_service(rp,"can't set script privileges",r);
}
/* Allow the script to run. */
if ((r = sys_privctl(endpoint, SYS_PRIV_ALLOW, NULL)) != OK) {
return kill_service(rp,"can't let the script run",r);
}
}
}
/*===========================================================================* /*===========================================================================*
* get_next_label * * get_next_label *
@ -1617,7 +1603,7 @@ char *caller_label;
if (len > RS_MAX_LABEL_LEN) if (len > RS_MAX_LABEL_LEN)
{ {
printf( printf(
"rs:get_next_label: bad ipc list entry '.*s' for %s: too long\n", "rs:get_next_label: bad ipc list entry '%.*s' for %s: too long\n",
len, p, caller_label); len, p, caller_label);
continue; continue;
} }

View File

@ -75,7 +75,6 @@ _PROTOTYPE( struct rproc* lookup_slot_by_label, (char *label) );
_PROTOTYPE( struct rproc* lookup_slot_by_pid, (pid_t pid) ); _PROTOTYPE( struct rproc* lookup_slot_by_pid, (pid_t pid) );
_PROTOTYPE( int alloc_slot, (struct rproc **rpp) ); _PROTOTYPE( int alloc_slot, (struct rproc **rpp) );
_PROTOTYPE( void free_slot, (struct rproc *rp) ); _PROTOTYPE( void free_slot, (struct rproc *rp) );
_PROTOTYPE( int run_script, (struct rproc *rp) );
_PROTOTYPE( char *get_next_label, (char *ptr, char *label, char *caller_label)); _PROTOTYPE( char *get_next_label, (char *ptr, char *label, char *caller_label));
_PROTOTYPE( void add_forward_ipc, (struct rproc *rp, struct priv *privp) ); _PROTOTYPE( void add_forward_ipc, (struct rproc *rp, struct priv *privp) );
_PROTOTYPE( void add_backward_ipc, (struct rproc *rp, struct priv *privp) ); _PROTOTYPE( void add_backward_ipc, (struct rproc *rp, struct priv *privp) );

View File

@ -827,7 +827,6 @@ PUBLIC void dev_up(int maj)
struct vmnt *vmp; struct vmnt *vmp;
struct fproc *rfp; struct fproc *rfp;
struct vnode *vp; struct vnode *vp;
message m;
/* Open a device once for every filp that's opened on it, /* Open a device once for every filp that's opened on it,
* and once for every filesystem mounted from it. * and once for every filesystem mounted from it.

View File

@ -30,7 +30,6 @@ PUBLIC int do_link()
{ {
/* Perform the link(name1, name2) system call. */ /* Perform the link(name1, name2) system call. */
int r = OK; int r = OK;
endpoint_t linked_fs_e, link_lastdir_fs_e;
struct vnode *vp, *vp_d; struct vnode *vp, *vp_d;
/* See if 'name1' (file to be linked to) exists. */ /* See if 'name1' (file to be linked to) exists. */
@ -72,7 +71,6 @@ PUBLIC int do_unlink()
* is almost the same. They differ only in some condition testing. Unlink() * is almost the same. They differ only in some condition testing. Unlink()
* may be used by the superuser to do dangerous things; rmdir() may not. * may be used by the superuser to do dangerous things; rmdir() may not.
*/ */
register struct fproc *rfp;
struct vnode *vldirp, *vp; struct vnode *vldirp, *vp;
int r; int r;
@ -126,7 +124,6 @@ PUBLIC int do_rename()
{ {
/* Perform the rename(name1, name2) system call. */ /* Perform the rename(name1, name2) system call. */
int r = OK, r1; int r = OK, r1;
size_t len;
struct vnode *old_dirp, *new_dirp, *vp; struct vnode *old_dirp, *new_dirp, *vp;
char old_name[PATH_MAX+1]; char old_name[PATH_MAX+1];
@ -218,7 +215,6 @@ PUBLIC int do_truncate()
PUBLIC int do_ftruncate() PUBLIC int do_ftruncate()
{ {
/* As with do_truncate(), truncate_vnode() does the actual work. */ /* As with do_truncate(), truncate_vnode() does the actual work. */
int r;
struct filp *rfilp; struct filp *rfilp;
if ((off_t) m_in.flength < 0) return(EINVAL); if ((off_t) m_in.flength < 0) return(EINVAL);
@ -255,9 +251,8 @@ off_t newsize;
PUBLIC int do_slink() PUBLIC int do_slink()
{ {
/* Perform the symlink(name1, name2) system call. */ /* Perform the symlink(name1, name2) system call. */
int r, linklen; int r;
struct vnode *vp; struct vnode *vp;
char string[NAME_MAX]; /* last component of the new dir's path name */
if(m_in.name1_length <= 1) return(ENOENT); if(m_in.name1_length <= 1) return(ENOENT);
if(m_in.name1_length >= SYMLINK_MAX) return(ENAMETOOLONG); if(m_in.name1_length >= SYMLINK_MAX) return(ENAMETOOLONG);

View File

@ -151,8 +151,6 @@ PUBLIC int do_fcntl()
register struct filp *f; register struct filp *f;
int new_fd, r, fl; int new_fd, r, fl;
long cloexec_mask; /* bit map for the FD_CLOEXEC flag */
long clo_value; /* FD_CLOEXEC flag in proper position */
struct filp *dummy; struct filp *dummy;
/* Is the file descriptor valid? */ /* Is the file descriptor valid? */
@ -533,7 +531,7 @@ int ngroups;
gid_t *groups; gid_t *groups;
{ {
struct fproc *rfp; struct fproc *rfp;
int slot, i; int slot;
okendpt(proc_e, &slot); okendpt(proc_e, &slot);
rfp = &fproc[slot]; rfp = &fproc[slot];
@ -623,7 +621,7 @@ PUBLIC int pm_dumpcore(proc_e, seg_ptr)
int proc_e; int proc_e;
struct mem_map *seg_ptr; struct mem_map *seg_ptr;
{ {
int r, proc_s; int proc_s;
/* Terminate the process */ /* Terminate the process */
okendpt(proc_e, &proc_s); okendpt(proc_e, &proc_s);

View File

@ -128,7 +128,6 @@ PRIVATE int mount_fs(endpoint_t fs_e)
struct fproc *tfp; struct fproc *tfp;
struct dmap *dp; struct dmap *dp;
dev_t dev; dev_t dev;
message m;
struct vnode *root_node, *vp = NULL, *bspec; struct vnode *root_node, *vp = NULL, *bspec;
struct vmnt *vmp; struct vmnt *vmp;
char *label; char *label;
@ -405,11 +404,10 @@ PUBLIC int unmount(dev, label)
Dev_t dev; /* block-special device */ Dev_t dev; /* block-special device */
char *label; /* buffer to retrieve label, or NULL */ char *label; /* buffer to retrieve label, or NULL */
{ {
struct vnode *vp, *vi; struct vnode *vp;
struct vmnt *vmp_i = NULL, *vmp = NULL; struct vmnt *vmp_i = NULL, *vmp = NULL;
struct dmap *dp; struct dmap *dp;
int count, r; int count, r;
int fs_e;
/* Find vmnt that is to be unmounted */ /* Find vmnt that is to be unmounted */
for(vmp_i = &vmnt[0]; vmp_i < &vmnt[NR_MNTS]; ++vmp_i) { for(vmp_i = &vmnt[0]; vmp_i < &vmnt[NR_MNTS]; ++vmp_i) {
@ -496,7 +494,6 @@ int allow_mountpt;
* and the path is the root node of a mounted file system, return that device * and the path is the root node of a mounted file system, return that device
* number. In all other cases, return NO_DEV and an error code in 'err_code'. * number. In all other cases, return NO_DEV and an error code in 'err_code'.
*/ */
int r;
dev_t dev; dev_t dev;
struct vnode *vp; struct vnode *vp;
@ -522,7 +519,7 @@ int allow_mountpt;
/*===========================================================================* /*===========================================================================*
* is_nonedev * * is_nonedev *
*===========================================================================*/ *===========================================================================*/
PRIVATE int is_nonedev(dev) PRIVATE int is_nonedev(int dev)
{ {
/* Return whether the given device is a "none" pseudo device. /* Return whether the given device is a "none" pseudo device.
*/ */

View File

@ -247,7 +247,6 @@ PRIVATE struct vnode *new_node(int oflags, mode_t bits)
struct vnode *dirp, *vp; struct vnode *dirp, *vp;
int r, flags; int r, flags;
struct node_details res; struct node_details res;
struct vnode *rest;
/* When O_CREAT and O_EXCL flags are set, the path may not be named by a /* When O_CREAT and O_EXCL flags are set, the path may not be named by a
* symbolic link. */ * symbolic link. */

View File

@ -111,7 +111,6 @@ PUBLIC struct vnode *last_dir(void)
* and parse the path up to the penultimate component. * and parse the path up to the penultimate component.
*/ */
int r;
size_t len; size_t len;
char *cp; char *cp;
char dir_entry[PATH_MAX+1]; char dir_entry[PATH_MAX+1];

View File

@ -46,7 +46,6 @@ PUBLIC int do_pipe()
struct filp *fil_ptr0, *fil_ptr1; struct filp *fil_ptr0, *fil_ptr1;
int fil_des[2]; /* reply goes here */ int fil_des[2]; /* reply goes here */
struct vnode *vp; struct vnode *vp;
struct vmnt *vmp;
struct node_details res; struct node_details res;
/* See if a free vnode is available */ /* See if a free vnode is available */
@ -581,7 +580,7 @@ int proc_nr_e;
*===========================================================================*/ *===========================================================================*/
PUBLIC int select_request_pipe(struct filp *f, int *ops, int block) 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;
orig_ops = *ops; orig_ops = *ops;
if ((*ops & (SEL_RD|SEL_ERR))) { if ((*ops & (SEL_RD|SEL_ERR))) {
if ((err = pipe_check(f->filp_vno, READING, 0, if ((err = pipe_check(f->filp_vno, READING, 0,

View File

@ -75,8 +75,6 @@ PUBLIC int do_chmod()
PUBLIC int do_chown() PUBLIC int do_chown()
{ {
/* Perform the chmod(name, mode) and fchmod(fd, mode) system calls. */ /* Perform the chmod(name, mode) and fchmod(fd, mode) system calls. */
int inode_nr;
int fs_e;
struct filp *flp; struct filp *flp;
struct vnode *vp; struct vnode *vp;
int r; int r;
@ -173,11 +171,10 @@ PUBLIC int forbidden(struct vnode *vp, mode_t access_desired)
* if it is forbidden, EACCES is returned. * if it is forbidden, EACCES is returned.
*/ */
register struct super_block *sp;
register mode_t bits, perm_bits; register mode_t bits, perm_bits;
uid_t uid; uid_t uid;
gid_t gid; gid_t gid;
int r, shift, type; int r, shift;
if (vp->v_uid == (uid_t) -1 || vp->v_gid == (gid_t) -1) return(EACCES); if (vp->v_uid == (uid_t) -1 || vp->v_gid == (gid_t) -1) return(EACCES);

View File

@ -43,14 +43,11 @@ int rw_flag; /* READING or WRITING */
/* Perform read(fd, buffer, nbytes) or write(fd, buffer, nbytes) call. */ /* Perform read(fd, buffer, nbytes) or write(fd, buffer, nbytes) call. */
register struct filp *f; register struct filp *f;
register struct vnode *vp; register struct vnode *vp;
off_t bytes_left;
u64_t position, res_pos, new_pos; u64_t position, res_pos, new_pos;
unsigned int off, cum_io, cum_io_incr, res_cum_io; unsigned int cum_io, cum_io_incr, res_cum_io;
int op, oflags, r, chunk, block_spec, char_spec; int op, oflags, r, block_spec, char_spec;
int regular; int regular;
mode_t mode_word; mode_t mode_word;
phys_bytes p;
struct dmap *dp;
/* If the file descriptor is valid, get the vnode, size and mode. */ /* If the file descriptor is valid, get the vnode, size and mode. */
if (m_in.nbytes < 0) return(EINVAL); if (m_in.nbytes < 0) return(EINVAL);
@ -154,7 +151,6 @@ PUBLIC int do_getdents()
/* Perform the getdents(fd, buf, size) system call. */ /* Perform the getdents(fd, buf, size) system call. */
int r; int r;
u64_t new_pos; u64_t new_pos;
cp_grant_id_t gid;
register struct filp *rfilp; register struct filp *rfilp;
/* Is the file descriptor valid? */ /* Is the file descriptor valid? */
@ -191,10 +187,10 @@ struct filp *f;
char *buf; char *buf;
size_t req_size; size_t req_size;
{ {
int r, oflags, partial_pipe = 0, r2; int r, oflags, partial_pipe = 0;
size_t size, cum_io, cum_io_incr, cum_io_incr2; size_t size, cum_io, cum_io_incr;
struct vnode *vp; struct vnode *vp;
u64_t position, new_pos, new_pos2; u64_t position, new_pos;
oflags = f->filp_flags; oflags = f->filp_flags;
vp = f->filp_vno; vp = f->filp_vno;

View File

@ -12,9 +12,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/statfs.h> #include <sys/statfs.h>
#include <minix/vfsif.h> #include <minix/vfsif.h>
#include <minix/callnr.h>
#include <minix/com.h> #include <minix/com.h>
#include <minix/keymap.h>
#include <minix/const.h> #include <minix/const.h>
#include <minix/endpoint.h> #include <minix/endpoint.h>
#include <minix/u64.h> #include <minix/u64.h>
@ -1027,7 +1025,6 @@ PRIVATE int fs_sendrec_f(char *file, int line, endpoint_t fs_e, message *reqm)
*/ */
int r, old_driver_e, new_driver_e; int r, old_driver_e, new_driver_e;
message origm, m; message origm, m;
struct vmnt *vmp;
if(fs_e <= 0 || fs_e == NONE) if(fs_e <= 0 || fs_e == NONE)
panic("talking to bogus endpoint: %d", fs_e); panic("talking to bogus endpoint: %d", fs_e);

View File

@ -714,7 +714,7 @@ PUBLIC void select_unsuspend_by_endpt(endpoint_t proc_e)
*===========================================================================*/ *===========================================================================*/
PUBLIC void select_reply1() PUBLIC void select_reply1()
{ {
int i, s, minor, status; int i, minor, status;
endpoint_t driver_e; endpoint_t driver_e;
dev_t dev; dev_t dev;
struct filp *fp; struct filp *fp;

View File

@ -75,7 +75,6 @@ int len; /* length of the directory name string */
{ {
/* Do the actual work for chdir() and chroot(). */ /* Do the actual work for chdir() and chroot(). */
struct vnode *vp; struct vnode *vp;
int r;
/* Try to open the directory */ /* Try to open the directory */
if (fetch_name(name_ptr, len, M3) != OK) return(err_code); if (fetch_name(name_ptr, len, M3) != OK) return(err_code);

View File

@ -22,7 +22,6 @@ PUBLIC int do_utime()
/* Perform the utime(name, timep) system call. */ /* Perform the utime(name, timep) system call. */
register int len; register int len;
int r; int r;
uid_t uid;
time_t actime, modtime; time_t actime, modtime;
struct vnode *vp; struct vnode *vp;

View File

@ -92,7 +92,7 @@ PUBLIC int isokendpt_f(char *file, int line, int endpoint, int *proc, int fatal)
endpoint_t ke; endpoint_t ke;
*proc = _ENDPOINT_P(endpoint); *proc = _ENDPOINT_P(endpoint);
if(endpoint == NONE) { if(endpoint == NONE) {
printf("vfs:%s: endpoint is NONE\n", file, line, endpoint); printf("vfs:%s:%d: endpoint is NONE\n", file, line);
failed = 1; failed = 1;
} else if(*proc < 0 || *proc >= NR_PROCS) { } else if(*proc < 0 || *proc >= NR_PROCS) {
printf("vfs:%s:%d: proc (%d) from endpoint (%d) out of range\n", printf("vfs:%s:%d: proc (%d) from endpoint (%d) out of range\n",