| 
      
      
      From: Yuri P. <yu...@sw...> - 2000-03-21 19:54:02
      
     | 
| Jeff Dike wrote:
> > In the CVS:
> >     - open_vt() from stdio_console_user.c conflicts with its prototype
> > and calling place.
>
> I just checked this out and I don't see a problem:
>
> This is the declaration:
>         extern int open_vt(int n, int *pid_out);
>
> This is the call:
>         static struct vt {
>           int fd;
>           int count;
>           int xterm_pid;
>         } vts[MAX_TTYS];
>
>         int line;
>         vts[line].fd = open_vt(line, &vts[line].xterm_pid);
>
> I grabbed those snippets from the cvs browser:
>
> http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/linux/arch/um/drivers/stdio_conso
> le.h?rev=1.2&content-type=text/x-cvsweb-markup&cvsroot=user-mode-linux
>         http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/linux/arch/um/drivers/stdio_cons
> ole.c?rev=1.6&content-type=text/x-cvsweb-markup&cvsroot=user-mode-linux
>
>                                 Jeff
From
http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/linux/arch/um/drivers/stdio_console_user.c?rev=1.6&content-type=text/x-cvsweb-markup&cvsroot=user-mode-linux
we see wrong open_vt() implementation:
int open_vt(int n)
{
    ....
}
Compile problem descriptions:
My build environment uses customized Mandrake 7.0 installation:
   - glibc 2.1.3
   - gcc 2.95.2.
Pristine uml-2.3.99-pre2 cannot compile without $(TOPDIR)/include{linux,asm} symlinked to
/usr/include/.
make[1]: Entering directory `/usr/src/linux-2.3.99pre-uml/arch/um/kernel'
gcc -D__KERNEL__ -D__KERNEL__ -Wall -Wstrict-prototypes -O2 -g -U__i386__ -D__arch_um__
-fwritable-strings -fno-strict-aliasing -I../include  -c -o process.o process.c
In file included from /usr/include/signal.h:294,
                 from process.c:3:
/usr/include/bits/sigcontext.h:28: asm/sigcontext.h: No such file or directory
In file included from /usr/include/errno.h:36,
                 from process.c:5:
/usr/include/bits/errno.h:25: linux/errno.h: No such file or directory
process.c:9: asm/ptrace.h: No such file or directory
make[1]: *** [process.o] Error 1
I fixed this by adding -I$(HPATH) to USER_CFLAGS in um/kernel/Makefile
3) syscall_user.c and trap_user.c still do not compile:
gcc -D__KERNEL__ -D__KERNEL__ -Wall -Wstrict-prototypes -O2 -g -U__i386__ -D__arch_um__
-fwritable-strings -fno-strict-aliasing -I/usr/src/linux-2.3.99pre-uml/include
-I../include  -c -o syscall_user.o syscall_user.c
In file included from syscall_user.c:12:
/usr/src/linux-2.3.99pre-uml/include/asm/unistd.h:14: conflicting types for `open'
/usr/include/fcntl.h:68: previous declaration of `open'
/usr/src/linux-2.3.99pre-uml/include/asm/unistd.h:21: conflicting types for `dup'
/usr/include/unistd.h:437: previous declaration of `dup'
/usr/src/linux-2.3.99pre-uml/include/asm/unistd.h:28: conflicting types for `close'
/usr/include/unistd.h:296: previous declaration of `close'
/usr/src/linux-2.3.99pre-uml/include/asm/unistd.h:35: conflicting types for `waitpid'
/usr/include/sys/wait.h:132: previous declaration of `waitpid'
make[1]: *** [syscall_user.o] Error 1
gcc -D__KERNEL__ -D__KERNEL__ -Wall -Wstrict-prototypes -O2 -g -U__i386__ -D__arch_um__
-fwritable-strings -fno-strict-aliasing -I/usr/src/linux-2.3.99pre-uml/include
-I../include  -c -o trap_user.o trap_user.c
In file included from trap_user.c:11:
/usr/src/linux-2.3.99pre-uml/include/asm/unistd.h:21: conflicting types for `dup'
/usr/include/unistd.h:437: previous declaration of `dup'
/usr/src/linux-2.3.99pre-uml/include/asm/unistd.h:28: conflicting types for `close'
/usr/include/unistd.h:296: previous declaration of `close'
/usr/src/linux-2.3.99pre-uml/include/asm/unistd.h:32: parse error before `pid'
/usr/src/linux-2.3.99pre-uml/include/asm/unistd.h:32: warning: function declaration isn't
a prototype
/usr/src/linux-2.3.99pre-uml/include/asm/unistd.h:34: parse error before `pid'
/usr/src/linux-2.3.99pre-uml/include/asm/unistd.h:35: conflicting types for `waitpid'
/usr/include/sys/wait.h:132: previous declaration of `waitpid'
/usr/src/linux-2.3.99pre-uml/include/asm/unistd.h: In function `waitpid':
/usr/src/linux-2.3.99pre-uml/include/asm/unistd.h:36: `pid' undeclared (first use in this
function)
/usr/src/linux-2.3.99pre-uml/include/asm/unistd.h:36: (Each undeclared identifier is
reported only once
/usr/src/linux-2.3.99pre-uml/include/asm/unistd.h:36: for each function it appears in.)
/usr/src/linux-2.3.99pre-uml/include/asm/unistd.h:36: `stat_addr' undeclared (first use
in this function)
/usr/src/linux-2.3.99pre-uml/include/asm/unistd.h:36: `options' undeclared (first use in
this function)
After working around the above bugs
(I commented out "include asm/unistd.h", leaving only libc unistd.h include),
I finally got ./linux executable linked.
It, however, segfaulted inside memcpy a bit after successfully opened "vm_file":
.....
read(4, "n", 1)                         = 1
read(4, "u", 1)                         = 1
read(4, "x", 1)                         = 1
read(4, "\n", 1)                        = 1
open("vm_file", O_RDWR|O_CREAT|O_EXCL, 0777) = 6
unlink("vm_file")                       = 0
lseek(6, 618496, SEEK_SET)              = 618496
write(6, "\0", 1)                       = 1
mmap(NULL, 618496, PROT_WRITE, MAP_SHARED, 6, 0) = 0x40000000
--- SIGSEGV (Segmentation fault) ---
+++ killed by SIGSEGV +++
Core was generated by
`./linux                                                                       '.
Program terminated with signal 11, Segmentation fault.
#0  0x1008ebf7 in memcpy ()
(gdb) bt
#0  0x1008ebf7 in memcpy ()
Cannot access memory at address 0xbffff748
Unfortunatly, gdb does not show stack trace and line info.
Any comments?
 |