Hi all

I have an application that uses the linux procfs extensively and also linux ipcs.  I found two problems in the current linux emulation. 

(I hope the diff provided below will work as is since my mailing program is a bit limited :)  )

1) linux_ipc.c has a pice of code commented that we can actually use now.  I think the other pieces were added later and this didn't get changed. The patch is valid for RELENG_4 and HEAD.  The current code will always remove only the first enry from a msg queue even if msgtyp was specified causing incorrect behaviour.  It's a one line change in linux_ipc.c in src/sys/compat/linux

2) When traversing the linprocfs with i.e. ls (the linux ls in /compat/linux/bin/ls ) I noticed that some entries in the proc table is missing, compared to doing a FreeBSD ls /bin/ls.   I traced the problem to a counter inconcistenct because linux reads smaller blocks at a time.  This problem is only in RELENG_4 and not HEAD since the linprocfs changed a lot in HEAD.   The loop skips the first 9 entries for the cpuinfo etc. in /compat/linux/proc, but on the second loop it skips the first 9 entries in the proc table and thus they do not show up in a /compat/linux/bin/ls

If someone responsible from the linux emulation can review these changes and maybe commit them, I'll appreciate it :)

Thanks

Reinier

 

------------------------ cut -------------------- cut -----------------------------

*** linprocfs_vnops.c   2001/08/12 14:29:19     1.3.2.5
--- linprocfs_vnops.c   2002/05/17 15:19:43
***************
*** 896,902 ****
 
 
                        default:
!                               while (pcnt < i) {
                                        p = p->p_list.le_next;
                                        if (!p)
                                                goto done;
--- 896,907 ----
 
 
                        default:
!                               /* Since we skip the first 9, by the time we
!                                * get here i = 9 and we'll end up skipping
!                                * the first 9 procs in the list, so we
!                                * increment pcnt by the same value
!                                */
!                               while ((pcnt + 9) < i) {
                                        p = p->p_list.le_next;
                                        if (!p)
                                                goto done;

----------------- cut -------------- cut ------------------ cut ----------------

*** linux_ipc.c.old     Fri May 17 11:08:58 2002
--- linux_ipc.c Fri May 17 11:09:29 2002
***************
*** 358,364 ****
      bsd_args.msqid = args->msqid;
      bsd_args.msgp = args->msgp;
      bsd_args.msgsz = args->msgsz;
!     bsd_args.msgtyp = 0; /* XXX - args->msgtyp; */
      bsd_args.msgflg = args->msgflg;
      return msgrcv(td, &bsd_args);
  }
--- 358,364 ----
      bsd_args.msqid = args->msqid;
      bsd_args.msgp = args->msgp;
      bsd_args.msgsz = args->msgsz;
!     bsd_args.msgtyp = args->msgtyp;
      bsd_args.msgflg = args->msgflg;
      return msgrcv(td, &bsd_args);
  }

----------------- cut ---------------- cut -------------- cut -----------------



Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience

Reply via email to