off_t *pos;
{
int access = 0, size;
- int m, j;
+ int j;
iovec_t *v;
/* Number of grants allocated in vector I/O. */
{
/* Files can be marked with the FD_CLOEXEC bit (in fp->fp_cloexec).
*/
- int i, proc;
- long bitmap;
+ int i;
- /* The array of FD_CLOEXEC bits is in the fp_cloexec bit map. */
- bitmap = rfp->fp_cloexec;
- if (bitmap) {
/* Check the file desriptors one by one for presence of FD_CLOEXEC. */
- for (i = 0; i < OPEN_MAX; i++) {
- if ( (bitmap >> i) & 01) (void) close_fd(rfp, i);
- }
- }
+ for (i = 0; i < OPEN_MAX; i++)
+ if ( FD_ISSET(i, &rfp->fp_cloexec_set))
+ (void) close_fd(rfp, i);
}
char fp_sesldr; /* true if proc is a session leader */
char fp_execced; /* true if proc has exec()ced after fork */
pid_t fp_pid; /* process id */
- long fp_cloexec; /* bit map for POSIX Table 6-2 FD_CLOEXEC */
+ fd_set fp_cloexec_set; /* bit map for POSIX Table 6-2 FD_CLOEXEC */
endpoint_t fp_endpoint; /* kernel endpoint number of this process */
} fproc[NR_PROCS];
if (NR_BUFS < 6) panic(__FILE__,"NR_BUFS < 6", NO_NUM);
if (V1_INODE_SIZE != 32) panic(__FILE__,"V1 inode size != 32", NO_NUM);
if (V2_INODE_SIZE != 64) panic(__FILE__,"V2 inode size != 64", NO_NUM);
- if (OPEN_MAX > 8 * sizeof(long))
- panic(__FILE__,"Too few bits in fp_cloexec", NO_NUM);
/* The following initializations are needed to let dev_opcl succeed .*/
fp = (struct fproc *) NULL;
register struct filp *f;
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;
/* Is the file descriptor valid? */
case F_GETFD:
/* Get close-on-exec flag (FD_CLOEXEC in POSIX Table 6-2). */
- return( ((fp->fp_cloexec >> m_in.fd) & 01) ? FD_CLOEXEC : 0);
+ return( FD_ISSET(m_in.fd, &fp->fp_cloexec_set) ? FD_CLOEXEC : 0);
case F_SETFD:
/* Set close-on-exec flag (FD_CLOEXEC in POSIX Table 6-2). */
- cloexec_mask = 1L << m_in.fd; /* singleton set position ok */
- clo_value = (m_in.addr & FD_CLOEXEC ? cloexec_mask : 0L);
- fp->fp_cloexec = (fp->fp_cloexec & ~cloexec_mask) | clo_value;
+ if(m_in.addr & FD_CLOEXEC)
+ FD_SET(m_in.fd, &fp->fp_cloexec_set);
+ else
+ FD_CLR(m_in.fd, &fp->fp_cloexec_set);
return(OK);
case F_GETFL:
if (r != OK)
{
printf("dumpcore pid %d: sys_trace failed "
- "at offset %d: %d\n",
+ "at offset %ld: %d\n",
rfp->fp_pid, trace_off, r);
break;
}
char *buf;
size_t bytes; /* how much is to be transferred? */
{
- int r, block_size;
+ int block_size;
off_t n, o, b_off;
block_t b;
struct buf *bp;
put_inode(rip);
}
- rfp->fp_cloexec &= ~(1L << fd_nr); /* turn off close-on-exec bit */
+ FD_CLR(fd_nr, &rfp->fp_cloexec_set);
rfp->fp_filp[fd_nr] = NIL_FILP;
FD_CLR(fd_nr, &rfp->fp_filp_inuse);
{
/* Perform the chmod(name, mode) system call. */
- register struct inode *rip;
+ register struct inode *rip = NULL;
register int r;
if(call_nr == CHMOD) {
{
/* Perform the chown(name, owner, group) system call. */
- register struct inode *rip;
+ register struct inode *rip = NULL;
register int r;
if(call_nr == CHOWN) {
int regular, partial_pipe = 0, partial_cnt = 0;
mode_t mode_word;
struct filp *wf;
- int block_size;
+ int block_size = 0;
int completed, r2 = OK;
phys_bytes p;
* Also free the double indirect block if that was the last entry in the
* double indirect block.
*/
- int scale, ind_ex, new_ind, new_dbl, zones, nr_indirects, single, zindex, ex;
+ int scale, ind_ex = 0, new_ind, new_dbl,
+ zones, nr_indirects, single, zindex, ex;
zone_t z, z1, z2 = NO_ZONE, old_zone;
register block_t b;
long excess, zone;