firefox & flash9 patches - linprocfs patch for 6.x
Juergen Lock
nox at jelal.kn-bremen.de
Sun Oct 5 16:43:34 UTC 2008
On Wed, Oct 01, 2008 at 06:52:37PM +0200, Tijl Coosemans wrote:
> On Monday 29 September 2008 22:02:37 Chagin Dmitry wrote:
> > please, test following patches (just -current).
> > with them firefox && flash9 forks for me,
> > I tested only on ia32 at amd64 with 2.6.16 enabled,
> > firefox 2.0.0.16 and flash9 plugin.
> >
> > If all is good, I will ask des@ and kib@ to review&commit them. thnx!
>
> On 7.1-PRERELEASE, linux 2.4, fc4, the linprocfs patch seems to improve
> things a lot. I'm still having crashes from time to time, but overall
> flash9 works much better. Great work!
>
> I've attached the patch for RELENG_7 (patch-linprocfs) and another
> patch for libflashsupport [1]. It should improve OSS support, A/V sync
> etc. For those without a linux box, I've attached a compiled version of
> the lib as well. You can drop it in /compat/linux/usr/lib.
>
> [1] http://sourceforge.net/projects/flashsupport/
I still have one box on 6.3, so today I tried the updated RELENG_7
linprocfs_doprocmaps() and libflashsupport there (using linux-base-fc4),
and got youtube working on there as well. I'll append the patch, which
should also apply on RELENG_6 and _6_4, tho with offset. (also at
http://people.freebsd.org/~nox/linprocfs-6.3.patch
)
Thanx again,
Juergen
Index: linprocfs.c
@@ -934,48 +934,47 @@ linprocfs_doprocenviron(PFS_FILL_ARGS)
static int
linprocfs_doprocmaps(PFS_FILL_ARGS)
{
- char mebuffer[512];
vm_map_t map = &p->p_vmspace->vm_map;
- vm_map_entry_t entry;
+ vm_map_entry_t entry, tmp_entry;
vm_object_t obj, tobj, lobj;
+ vm_offset_t saved_end;
vm_ooffset_t off = 0;
char *name = "", *freename = NULL;
- size_t len;
ino_t ino;
+ unsigned int last_timestamp;
int ref_count, shadow_count, flags;
int error;
struct vnode *vp;
struct vattr vat;
int locked;
-
+
PROC_LOCK(p);
error = p_candebug(td, p);
PROC_UNLOCK(p);
if (error)
return (error);
-
+
if (uio->uio_rw != UIO_READ)
return (EOPNOTSUPP);
-
- if (uio->uio_offset != 0)
- return (0);
-
+
error = 0;
- if (map != &curthread->td_proc->p_vmspace->vm_map)
- vm_map_lock_read(map);
- for (entry = map->header.next;
- ((uio->uio_resid > 0) && (entry != &map->header));
+ vm_map_lock_read(map);
+ for (entry = map->header.next; entry != &map->header;
entry = entry->next) {
name = "";
freename = NULL;
if (entry->eflags & MAP_ENTRY_IS_SUB_MAP)
continue;
+ saved_end = entry->end;
obj = entry->object.vm_object;
- for (lobj = tobj = obj; tobj; tobj = tobj->backing_object)
+ for (lobj = tobj = obj; tobj; tobj = tobj->backing_object) {
+ VM_OBJECT_LOCK(tobj);
+ if (lobj != obj)
+ VM_OBJECT_UNLOCK(lobj);
lobj = tobj;
+ }
ino = 0;
if (lobj) {
- VM_OBJECT_LOCK(lobj);
off = IDX_TO_OFF(lobj->size);
if (lobj->type == OBJT_VNODE) {
vp = lobj->handle;
@@ -984,10 +983,12 @@ linprocfs_doprocmaps(PFS_FILL_ARGS)
}
else
vp = NULL;
+ if (lobj != obj)
+ VM_OBJECT_UNLOCK(lobj);
flags = obj->flags;
ref_count = obj->ref_count;
shadow_count = obj->shadow_count;
- VM_OBJECT_UNLOCK(lobj);
+ VM_OBJECT_UNLOCK(obj);
if (vp) {
vn_fullpath(td, vp, &name, &freename);
locked = VFS_LOCK_GIANT(vp->v_mount);
@@ -1007,7 +1008,7 @@ linprocfs_doprocmaps(PFS_FILL_ARGS)
* format:
* start, end, access, offset, major, minor, inode, name.
*/
- snprintf(mebuffer, sizeof mebuffer,
+ error = sbuf_printf(sb,
"%08lx-%08lx %s%s%s%s %08lx %02x:%02x %lu%s%s\n",
(u_long)entry->start, (u_long)entry->end,
(entry->protection & VM_PROT_READ)?"r":"-",
@@ -1023,19 +1024,23 @@ linprocfs_doprocmaps(PFS_FILL_ARGS)
);
if (freename)
free(freename, M_TEMP);
- len = strlen(mebuffer);
- if (len > uio->uio_resid)
- len = uio->uio_resid; /*
- * XXX We should probably return
- * EFBIG here, as in procfs.
- */
- error = uiomove(mebuffer, len, uio);
- if (error)
- break;
- }
- if (map != &curthread->td_proc->p_vmspace->vm_map)
+ last_timestamp = map->timestamp;
vm_map_unlock_read(map);
-
+ if (error == -1)
+ return (0);
+ vm_map_lock_read(map);
+ if (last_timestamp + 1 != map->timestamp) {
+ /*
+ * Look again for the entry because the map was
+ * modified while it was unlocked. Specifically,
+ * the entry may have been clipped, merged, or deleted.
+ */
+ vm_map_lookup_entry(map, saved_end - 1, &tmp_entry);
+ entry = tmp_entry;
+ }
+ }
+ vm_map_unlock_read(map);
+
return (error);
}
More information about the freebsd-emulation
mailing list