LA MEMORIA SE ME EMPETA ( solUCION FINAL )
Javier :
El problema con netscape era un bug :
Aqui tiene la solucion detallada :
si quieres revisar la fuente
cheque aqui : http://lwn.net/1999/0128/a/netscape-hack.html
Espero que te sirva
Lord of Linux
From: Stanislav Meduna <stano@trillian.eunet.sk>
Subject: Re: Netscape buggy, kernel OK - some test results
To: linux-kernel@vger.rutgers.edu
Date: Sat, 23 Jan 1999 19:00:24 +0100 (CET)
> I'll try to polish my hack a bit - seems like
> it can help more people.
Those who have problem with freezing netscape,
please try the following code. If it helps, we
are sure that the kernel is not the problem.
It works for me with 2.2.0-final and Netscape 4.5,
I have not tested it very carefully and I don't
guarantee it works anywhere else.
Thanks
Stano
========
#include <dlfcn.h>
#include <unistd.h>
#include <limits.h>
/* This is a netscape bug workaround. Search for a pipe,
where only 1 byte strings \0372 are written to the write
end and only 1 byte strings are requested back. Count
the difference and fake any writes that would cause
an overflow of the pipe and corresponding reads.
This is a really dirty hack with almost no error checking
and relying on the netscape's behaviour.
Compile with
gcc -c nspipepatch.c
ld -shared -o libnspipepatch.so -ldl nspipepatch.o
and add
LD_PRELOAD=<path>/libnspipepatch.so
to your netscape starting script.
(C) 1999 Stanislav Meduna <stano@trillian.eunet.sk>
There is absolutely NO WARRANTY. The use and distribution
is completely free
*/
/* The magic netscape char flowing through the pipe */
#define MAGIC ((unsigned char) '\372')
/* libc handle for dlsym */
static void *dlhdl=0;
/* pointers to overloaded functions */
static int (*pipe_fp)(int [2])=0;
static ssize_t (*write_fp)(int, const void *, size_t)=0;
static ssize_t (*read_fp)(int, void *, size_t)=0;
static int (*close_fp)(int)=0;
/* we keep the info about our descriptors here */
static struct nshack_pipe_t
{
/* If this is a pipe that could be our one,
mark both ends here. If we shouldn't touch
the descriptor, enter -1 here
*/
int read_end, write_end;
/* The difference between writes and reads,
maintained on the write end
*/
int diff;
/* Number of faked writes, maintained on the write end */
int faked;
} fdflags[256];
/* Mark the descriptors as unused or not of our interest */
static void clearfd(int fd)
{
fdflags[fd].read_end = fdflags[fd].write_end = -1;
fdflags[fd].diff = fdflags[fd].faked = 0;
}
/* Clear both ends */
static void clearboth(int fd)
{
int rd = fdflags[fd].read_end;
int wr = fdflags[fd].write_end;
if (rd >= 0)
clearfd(rd);
if (wr >= 0)
clearfd(wr);
}
/* Init the pointers to overloaded functions */
static void initptrs()
{
int i;
dlhdl = dlopen("/lib/libc.so.6", RTLD_NOW);
if (! dlhdl)
exit(99);
pipe_fp = dlsym(dlhdl, "pipe");
write_fp = dlsym(dlhdl, "write");
read_fp = dlsym(dlhdl, "read");
close_fp = dlsym(dlhdl, "close");
if (! pipe_fp || ! write_fp || ! read_fp || ! close_fp)
exit(99);
for (i=0; i < sizeof(fdflags)/sizeof(fdflags[0]); i++)
clearfd(i);
}
/* Unload the library */
void _fini()
{
if (dlhdl)
dlclose(dlhdl);
}
/* Overloaded pipe - mark the fresh pipes */
int pipe(int fd[2])
{
int res;
if (! pipe_fp)
initptrs();
res = (*pipe_fp)(fd);
if (! res)
{
/* This could be our pipe - watch it during read/write */
fdflags[fd[0]].read_end = fdflags[fd[1]].read_end = fd[0];
fdflags[fd[0]].write_end = fdflags[fd[1]].write_end= fd[1];
fdflags[fd[0]].diff = fdflags[fd[1]].faked = 0;
}
return res;
}
/* Overloaded write */
ssize_t write(int fd, const void *buf, size_t cnt)
{
int res=0;
if (! write_fp)
initptrs();
if (cnt != 1 || *(unsigned char *)buf != MAGIC)
clearboth(fd); /* This is not our pipe - magic not seen */
if (fd == fdflags[fd].write_end)
{
/* This is the write end of a watched pipe */
fdflags[fd].diff++;
/* Play safe - reduce the allowed difference
to guard against off-by-one errors and
similar :-)
*/
if (fdflags[fd].diff >= PIPE_BUF-64)
{
/* We fake the write */
fdflags[fd].faked++;
res = 1;
}
else
res = (*write_fp)(fd, buf, cnt);
}
else
res = (*write_fp)(fd, buf, cnt);
return res;
}
/* Overloaded read */
ssize_t read(int fd, void *buf, size_t cnt)
{
int res;
int watch=0;
if (! read_fp)
initptrs();
if (fd == fdflags[fd].read_end)
{
if (cnt == 1)
watch = 1;
else
clearboth(fd); /* The true one always wants one char only */
/* This is the read end of a watched pipe */
if (watch && fdflags[fdflags[fd].write_end].faked)
{
/* Faked writes exist - compensate with faked reads */
fdflags[fdflags[fd].write_end].faked--;
fdflags[fdflags[fd].write_end].diff--;
*((unsigned char *) buf) = MAGIC;
return 1;
}
}
/* Do the real read */
res = (*read_fp)(fd, buf, cnt);
if (watch && res == 1)
{
/* If we watch the pipe and the read was successfull,
use the read value to make sure this is THE pipe.
*/
if (*((unsigned char *) buf) == MAGIC)
fdflags[fd].diff--;
else
clearboth(fd);
}
return res;
}
/* Overloaded close (we want to be at least a bit correct) */
int close(int fd)
{
if (! close_fp)
initptrs();
if (fd == fdflags[fd].read_end || fd == fdflags[fd].write_end)
clearboth(fd);
return (*close_fp)(fd);
}
========
Javier Viñuales Gutiérrez wrote:
> On mié, ene 20, 1999 at 01:50:36 -0800, Lord of Linux wrote:
> > Javier Vinuales:
> >
> > Olvidate de tu swap , yo tengo una pentium 133 Mhz con 32 Mb de Ram y 24 Mb
> > swap y me trabaja bien el netscape 4.07 con afterstep
> > tiene que revisar que procesos tiene activos que distribucion usas , tiene que decir que
> > decir que es lo que tiene en la memoria , demonios , ambiente grafico , etc ,etc ,etc
> > asi con toda esa informacion : nuestras oficinas de atencion pueden atenderte mucho mejor
>
> Pues por información que no quede...
>
> Mira, ahora mismo tengo abierto:
> [vigu@akela]# ps x
> PID TTY STAT TIME COMMAND
> 185 ? S 0:00 /bin/sh /etc/X11/Xsession
> 187 ? S 0:02 /usr/X11R6/bin/WindowMaker
> 192 ? S 0:00 wmtime
> 193 ? S 0:00 wmmon
> 194 ? S 0:01 wmmail
> 195 ? S 0:00 wmppp -t
> 196 ? S 0:00 mount.app
> 200 ? S 0:00 /usr/X11R6/bin/xconsole -geometry 480x130-0-0 -daemon -notif
> 202 ? S 0:00 wmsound
> 203 p1 S 0:00 bash
> 204 p0 S 0:00 bash
> 243 ? S 0:02 /usr/lib/netscape/netscape-communicator
> 248 ? S 0:00 (dns helper)
> 294 ? S 0:00 rxvt -name MUTT -bg black -fg white -geometry 110x40 -e mutt
> 295 p2 S 0:00 mutt
> 299 p2 S 0:00 jed /tmp/mutt-akela-295-20
> 303 p1 R 0:00 ps x
>
> y dentro de aproximadamente cuatro horas se empetará casi con toda
> seguridad si navego durante todo ese tiempo con Netscape 4.5... cosa que no
> va a sucederme hoy pues me voy a la piltra ya $-0
>
> La fotografía de recursos usados al detalle es como sigue:
> [vigu@akela]# top
> 1:01am up 29 min, 4 users, load average: 1.00, 1.05, 0.91
> 48 processes: 44 sleeping, 4 running, 0 zombie, 0 stopped
> CPU states: 85.5% user, 14.4% system, 83.3% nice, 0.5% idle
> Mem: 63248K av, 60624K used, 2624K free, 37024K shrd, 4460K buff
> Swap: 29700K av, 80K used, 29620K free 30556K cached
>
> PID USER PRI NI SIZE RSS SHARE STAT LIB %CPU %MEM TIME COMMAND
> 135 nobody 20 19 404 404 280 R N 0 83.3 0.6 27:55 distributed-net
> 202 vigu 0 0 616 616 532 S 0 13.4 0.9 0:03 wmsound
> 169 root 0 0 22308 21M 1484 R 0 2.1 35.2 0:19 XBF_i740
> 191 root 0 0 1908 1908 1384 R 0 0.3 3.0 0:02 xterm
> 327 vigu 1 0 748 748 560 R 0 0.3 1.1 0:00 top
> 187 vigu 0 0 2460 2460 1460 S 0 0.1 3.8 0:02 WindowMaker
> 1 root 0 0 384 384 324 S 0 0.0 0.6 0:03 init
> 2 root 0 0 0 0 0 SW 0 0.0 0.0 0:00 kflushd
> 3 root 0 0 0 0 0 SW 0 0.0 0.0 0:00 kswapd
> 12 root 0 0 228 228 188 S 0 0.0 0.3 0:00 update
> 107 root 0 0 512 512 408 S 0 0.0 0.8 0:00 syslogd
> 109 root 0 0 432 432 328 S 0 0.0 0.6 0:00 klogd
> 114 #1 0 0 356 356 284 S 0 0.0 0.5 0:00 portmap
> 116 root 0 0 448 448 372 S 0 0.0 0.7 0:00 inetd
> 119 root 0 0 380 380 328 S 0 0.0 0.6 0:00 apmd
> 122 nobody 19 19 404 404 280 S N 0 0.0 0.6 0:00 distributed-net
> 126 root 0 0 360 360 308 S 0 0.0 0.5 0:00 gpm
> 131 lp 0 0 864 864 640 S 0 0.0 1.3 0:00 lpd
> 134 nobody 19 19 404 404 280 S N 0 0.0 0.6 0:00 distributed-net
> 139 root 0 0 828 796 600 S 0 0.0 1.2 0:00 sendmail
> 151 root 0 0 492 492 396 S 0 0.0 0.7 0:00 cron
> 161 root 0 0 860 860 740 S 0 0.0 1.3 0:00 xdm
> 162 root 0 0 416 416 340 S 0 0.0 0.6 0:00 getty
> 163 root 0 0 416 416 340 S 0 0.0 0.6 0:00 getty
> 164 root 0 0 416 416 340 S 0 0.0 0.6 0:00 getty
> 165 root 0 0 416 416 340 S 0 0.0 0.6 0:00 getty
> 166 root 0 0 416 416 340 S 0 0.0 0.6 0:00 getty
> 167 root 0 0 416 416 340 S 0 0.0 0.6 0:00 getty
> 170 root 0 0 1432 1412 1080 S 0 0.0 2.2 0:00 xdm
> 185 vigu 0 0 804 804 648 S 0 0.0 1.2 0:00 sh
> 186 root 0 0 780 780 660 S 0 0.0 1.2 0:00 imwheel
> 189 root 0 0 1668 1668 1304 S 0 0.0 2.6 0:00 xterm
> 192 vigu 0 0 820 820 664 S 0 0.0 1.2 0:00 wmtime
> 193 vigu 0 0 792 792 656 S 0 0.0 1.2 0:00 wmmon
> 194 vigu 0 0 1172 1172 988 S 0 0.0 1.8 0:01 wmmail
> 195 vigu 0 0 740 740 624 S 0 0.0 1.1 0:00 wmppp
> 196 vigu 0 0 884 884 736 S 0 0.0 1.3 0:00 mount.app
> 200 vigu 0 0 1152 1124 928 S 0 0.0 1.7 0:00 xconsole.real
> 203 vigu 0 0 1264 1264 928 S 0 0.0 1.9 0:00 bash
> 204 vigu 0 0 1232 1232 912 S 0 0.0 1.9 0:00 bash
> 219 root 0 0 620 620 508 S 0 0.0 0.9 0:00 pppd
> 235 root 0 0 680 680 540 S 0 0.0 1.0 0:00 fetchmail
> 236 root 0 0 328 328 272 S 0 0.0 0.5 0:00 tail
> 243 vigu 0 0 13896 13M 7688 S 0 0.0 21.9 0:03 netscape-commun
> 248 vigu 0 0 3608 3608 3048 S 0 0.0 5.7 0:00 netscape-commun
> 294 vigu 0 0 1216 1216 872 S 0 0.0 1.9 0:00 rxvt
> 295 vigu 0 0 1440 1440 792 S 0 0.0 2.2 0:00 mutt
> 299 vigu 0 0 1040 1040 552 S 0 0.0 1.6 0:00 jed
>
> Mi ordenador es: PII 400 Mhz, 64 Mb RAM.
>
> Creo que esta vez si hay información en profundidad para analizar la
> situación ¿no?.
>
> Gracias.
> --
>
> Javier Viñuales Gutiérrez
> vigu@ctv.es
>
> --
> Unsubscribe? mail -s unsubscribe debian-user-spanish-request@lists.debian.org < /dev/null
Reply to: