Linux-Development-Sys Digest #250, Volume #8 Wed, 1 Nov 00 11:13:20 EST
Contents:
Why does this stuff no work ? (Christoph Lechner)
Re: rpm build qt-2.2.1 ("O.Petzold")
Re: using /linuxrc (Peter Pointner)
User thread implementation problem ([EMAIL PROTECTED])
Re: Why does this stuff no work ? (David Weis)
Re: IP Masq Module Writing? (Daniel Franklin)
KernelWiki for November: Dia de Muertos (Gary Lawrence Murphy)
Re: rpm build qt-2.2.1 (Donovan Rebbechi)
Re: Can I create a floppy with a simple Linux? (Grant Edwards)
----------------------------------------------------------------------------
From: Christoph Lechner <[EMAIL PROTECTED]>
Subject: Why does this stuff no work ?
Date: Wed, 01 Nov 2000 12:15:21 +0100
Hallo,
I've got my example source code from the SCSI-Programming-HOWTO. My IDE
CD-ROM drive is
/dev/sr0 (because of SCSI emulation). But why can I only open it
readonly ?
Any suggestions ?
- C. Lechner
--- [snip] ---
#define DEVICE "/dev/sr0"
/* Example program to demonstrate the generic SCSI interface */
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include <scsi/sg.h>
#define SCSI_OFF sizeof(struct sg_header)
static unsigned char cmd[SCSI_OFF + 18]; /* SCSI command buffer
*/
int fd; /* SCSI device/file descriptor
*/
/* process a complete scsi cmd. Use the generic scsi interface. */
static int handle_scsi_cmd(unsigned cmd_len, /* command length
*/
unsigned in_size, /* input data
size */
unsigned char *i_buff, /* input buffer
*/
unsigned out_size, /* output data
size */
unsigned char *o_buff /* output buffer
*/
)
{
int status = 0;
struct sg_header *sg_hd;
/* safety checks */
if (!cmd_len) return -1; /* need a cmd_len != 0 */
if (!i_buff) return -1; /* need an input buffer !=
NULL */
#ifdef SG_BIG_BUFF
if (SCSI_OFF + cmd_len + in_size > SG_BIG_BUFF) return -1;
if (SCSI_OFF + out_size > SG_BIG_BUFF) return -1;
#else
if (SCSI_OFF + cmd_len + in_size > 4096) return -1;
if (SCSI_OFF + out_size > 4096) return -1;
#endif
if (!o_buff) out_size = 0;
/* generic scsi device header construction */
sg_hd = (struct sg_header *) i_buff;
sg_hd->reply_len = SCSI_OFF + out_size;
sg_hd->twelve_byte = cmd_len == 12;
sg_hd->result = 0;
#if 0
sg_hd->pack_len = SCSI_OFF + cmd_len + in_size; /* not
necessary */
sg_hd->pack_id; /* not used */
sg_hd->other_flags; /* not used */
#endif
/* send command */
status = write( fd, i_buff, SCSI_OFF + cmd_len + in_size );
if ( status < 0 || status != SCSI_OFF + cmd_len + in_size ||
sg_hd->result ) {
/* some error happened */
fprintf( stderr, "write(generic) result = 0x%x cmd = 0x%x\n",
sg_hd->result, i_buff[SCSI_OFF] );
perror("");
return status;
}
if (!o_buff) o_buff = i_buff; /* buffer pointer check */
/* retrieve result */
status = read( fd, o_buff, SCSI_OFF + out_size);
if ( status < 0 || status != SCSI_OFF + out_size || sg_hd->result
) {
/* some error happened */
fprintf( stderr, "read(generic) result = 0x%x cmd = 0x%x\n",
sg_hd->result, o_buff[SCSI_OFF] );
fprintf( stderr, "read(generic) sense "
"%x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x\n",
sg_hd->sense_buffer[0],
sg_hd->sense_buffer[1],
sg_hd->sense_buffer[2],
sg_hd->sense_buffer[3],
sg_hd->sense_buffer[4],
sg_hd->sense_buffer[5],
sg_hd->sense_buffer[6],
sg_hd->sense_buffer[7],
sg_hd->sense_buffer[8],
sg_hd->sense_buffer[9],
sg_hd->sense_buffer[10],
sg_hd->sense_buffer[11],
sg_hd->sense_buffer[12],
sg_hd->sense_buffer[13],
sg_hd->sense_buffer[14],
sg_hd->sense_buffer[15]);
if (status < 0)
perror("");
}
/* Look if we got what we expected to get */
if (status == SCSI_OFF + out_size) status = 0; /* got them all */
return status; /* 0 means no error */
}
#define INQUIRY_CMD 0x12
#define INQUIRY_CMDLEN 6
#define INQUIRY_REPLY_LEN 96
#define INQUIRY_VENDOR 8 /* Offset in reply data to vendor name
*/
/* request vendor brand and model */
static unsigned char *Inquiry ( void )
{
unsigned char Inqbuffer[ SCSI_OFF + INQUIRY_REPLY_LEN ];
unsigned char cmdblk [ INQUIRY_CMDLEN ] =
{ INQUIRY_CMD, /* command */
0, /* lun/reserved */
0, /* page code */
0, /* reserved */
INQUIRY_REPLY_LEN, /* allocation length */
0 };/* reserved/flag/link */
memcpy( cmd + SCSI_OFF, cmdblk, sizeof(cmdblk) );
/*
* +------------------+
* | struct sg_header | <- cmd
* +------------------+
* | copy of cmdblk | <- cmd + SCSI_OFF
* +------------------+
*/
if (handle_scsi_cmd(sizeof(cmdblk), 0, cmd,
sizeof(Inqbuffer) - SCSI_OFF, Inqbuffer )) {
fprintf( stderr, "Inquiry failed\n" );
exit(2);
}
return (Inqbuffer + SCSI_OFF);
}
#define TESTUNITREADY_CMD 0
#define TESTUNITREADY_CMDLEN 6
#define ADD_SENSECODE 12
#define ADD_SC_QUALIFIER 13
#define NO_MEDIA_SC 0x3a
#define NO_MEDIA_SCQ 0x00
int TestForMedium ( void )
{
/* request READY status */
static unsigned char cmdblk [TESTUNITREADY_CMDLEN] = {
TESTUNITREADY_CMD, /* command */
0, /* lun/reserved */
0, /* reserved */
0, /* reserved */
0, /* reserved */
0};/* reserved */
memcpy( cmd + SCSI_OFF, cmdblk, sizeof(cmdblk) );
/*
* +------------------+
* | struct sg_header | <- cmd
* +------------------+
* | copy of cmdblk | <- cmd + SCSI_OFF
* +------------------+
*/
if (handle_scsi_cmd(sizeof(cmdblk), 0, cmd,
0, NULL)) {
fprintf (stderr, "Test unit ready failed\n");
exit(2);
}
return
*(((struct sg_header*)cmd)->sense_buffer +ADD_SENSECODE) !=
NO_MEDIA_SC ||
*(((struct sg_header*)cmd)->sense_buffer +ADD_SC_QUALIFIER) !=
NO_MEDIA_SCQ;
}
void main( void )
{
fd = open(DEVICE, O_RDWR);
if (fd < 0) {
fprintf( stderr, "Need read/write permissions for "DEVICE".\n" );
exit(1);
}
/* print some fields of the Inquiry result */
printf( "%s\n", Inquiry() + INQUIRY_VENDOR );
/* look if medium is loaded */
if (!TestForMedium()) {
printf("device is unloaded\n");
} else {
printf("device is loaded\n");
}
}
------------------------------
From: "O.Petzold" <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps,linux.redhat.rpm
Subject: Re: rpm build qt-2.2.1
Date: Wed, 01 Nov 2000 10:03:04 +0100
>
> You should either get the build terminating with an error message,
> or a message that says is wrote an RPM and where it wrote it
>
That the last tail of the build process. I guess, there are should build. I
had to change the
spec file. I havn't a cp command which known the
cp -frL include/. $RPM_BUILD_ROOT%{_libdir}/qt-%{version}/include
^
syntax and I have a separate /tmp, /var, /usr/, /usr/src partitions.
Where are my rpms ?
Thanks Olaf
+ rm -rf doc/man
+ mkdir -p /var/tmp/qt-root/usr/bin
+ ln -sf ../lib/qt-2.2.1/bin/moc /var/tmp/qt-root/usr/bin
+ ln -sf ../lib/qt-2.2.1/bin/uic /var/tmp/qt-root/usr/bin
+ ln -sf ../lib/qt-2.2.1/bin/designer /var/tmp/qt-root/usr/bin
+ ln -sf ../lib/qt-2.2.1/bin/makeqpf /var/tmp/qt-root/usr/bin
+ ln -sf ../lib/qt-2.2.1/bin/mergetr /var/tmp/qt-root/usr/bin
+ ln -sf ../lib/qt-2.2.1/bin/msg2qm /var/tmp/qt-root/usr/bin
+ ln -sf ../lib/qt-2.2.1/bin/qconfig /var/tmp/qt-root/usr/bin
+ echo /usr/doc
+ grep share
+ ln -s ../../doc/qt-devel-2.2.1 /var/tmp/qt-root/usr/lib/qt-2.2.1/doc
+ /usr/lib/rpm/brp-compress
+ /usr/lib/rpm/brp-strip
+ /usr/lib/rpm/brp-strip-comment-note
Processing files: qt-2.2.1-5
Executing(%doc): /bin/sh -e /var/tmp/rpm-tmp.39938
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd qt-2.2.1
+ DOCDIR=/var/tmp/qt-root/usr/doc/qt-2.2.1
+ export DOCDIR
+ rm -rf /var/tmp/qt-root/usr/doc/qt-2.2.1
+ /bin/mkdir -p /var/tmp/qt-root/usr/doc/qt-2.2.1
+ cp -pr ANNOUNCE FAQ LICENSE.QPL PORTING README README.QT changes-2.2.0
changes-2.2.1 /var/tmp/qt-root/usr/doc/qt-2.2.1
+ exit 0
Finding Provides: (using /usr/lib/rpm/find-provides)...
Finding Requires: (using /usr/lib/rpm/find-requires)...
Provides: libqt-mt.so.2 libqt.so.2 libqutil.so.1
PreReq: /sbin/ldconfig /bin/sh
Requires: ld-linux.so.2 libGL.so.1 libGLU.so.1 libICE.so.6 libSM.so.6
libX11.so.6 libXext.so.6 libXi.so.6 libXmu.so.6 libXt.so.6 libc.so.6 libjp
eg.so.62 libm.so.6 libpng.so.2 libpthread.so.0 libqt.so.2
libstdc++-libc6.1-2.so.3 libz.so.1 libc.so.6(GLIBC_2.0)
libc.so.6(GLIBC_2.1) libpthrea
d.so.0(GLIBC_2.0) libpthread.so.0(GLIBC_2.1)
Processing files: qt-devel-2.2.1-5
File not found: /var/tmp/qt-root/usr/bin/findtr
File not found: /var/tmp/qt-root/usr/bin/qt20fix
File not found: /var/tmp/qt-root/usr/bin/qtrename140
Executing(%doc): /bin/sh -e /var/tmp/rpm-tmp.7342
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd qt-2.2.1
+ DOCDIR=/var/tmp/qt-root/usr/doc/qt-devel-2.2.1
+ export DOCDIR
+ rm -rf /var/tmp/qt-root/usr/doc/qt-devel-2.2.1
+ /bin/mkdir -p /var/tmp/qt-root/usr/doc/qt-devel-2.2.1
+ cp -pr doc/html /var/tmp/qt-root/usr/doc/qt-devel-2.2.1
+ cp -pr examples /var/tmp/qt-root/usr/doc/qt-devel-2.2.1
+ cp -pr tutorial /var/tmp/qt-root/usr/doc/qt-devel-2.2.1
+ exit 0
Requires: qt = 2.2.1-5
Processing files: qt-Xt-2.2.1-5
Finding Provides: (using /usr/lib/rpm/find-provides)...
Finding Requires: (using /usr/lib/rpm/find-requires)...
Requires: qt = 2.2.1-5
Processing files: qt-static-2.2.1-5
Finding Provides: (using /usr/lib/rpm/find-provides)...
Finding Requires: (using /usr/lib/rpm/find-requires)...
Requires: qt-devel = 2.2.1-5
------------------------------
From: Peter Pointner <[EMAIL PROTECTED]>
Subject: Re: using /linuxrc
Date: 1 Nov 2000 10:48:12 +0100
Kasper Dupont <[EMAIL PROTECTED]> wrote:
> Peter Pointner wrote:
>>
> [...]
>>
>> My /linuxrc does not execute init. init never gets started, I simply don't
>> need it for this embedded system.
>>
>> Peter
> It would probably be a better idea not to
> use the initrd feature. Instead you should
> just use your ramdisk as root and rename
> your linuxrc to /sbin/init.
> Or perhaps even better use init and modify
> /etc/inittab so it just calls your program.
> You could then make use of the respawn
> feature. Of course if your diskspace is
> extremly thight that might not work.
Thanks for the hints, but I have no problem with my setup.
I do not need the respawn feature. I do not have orphaned
processes. And I am too lazy to use init just to make this
embedded system look more like a standard system.
Peter
------------------------------
From: [EMAIL PROTECTED]
Subject: User thread implementation problem
Date: Wed, 01 Nov 2000 14:16:00 GMT
I'm trying to port a user-level thread package to Linux. The package
does the usual tricks with setjmp()/ longjmp() and allocating stacks
for new threads. It runs fine under Solaris/gcc/glibc and on Win32;
it's only under Linux/gcc/glibc that the problem occurs.
The specific problem is that programs that use the user-level thread
library crash inside glibc calls such as select(), poll() and free().
Exactly which glibc call crashes depends on whether or not I link with -
lpthreads. If I do, the crash occurs inside select() or poll(). If I
don't, the crash occurs inside free().
Does anyone have any clue as to what might be different between the
glibc implementation on Solaris and Linux that might cause this?? One
guess is that the problem occurs when glibc tries to get or free a
lock. Is there any way this could be disrupted if execution has changed
to a new stack??
Another guess is that the problem might relate to the fact that (as
someone told me) Linux/gcc uses the current stack pointer value to
identify the currently running thread. This sounds promising, but if it
is a likely cause of the problem can anyone explain how/ why
(especially as the problem still occurs without -lpthreads)?
Any help or ideas are most welcome!
Thanks,
Geoff
--
Dr. Geoff Coulson,
Lancaster University
Lancaster LA1 4LA,
England
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
From: David Weis <[EMAIL PROTECTED]>
Subject: Re: Why does this stuff no work ?
Date: Wed, 1 Nov 2000 08:40:17 -0600
because sr0 is a readonly device. scsi generics use sg0, sg1, etc. if the
cdrom is your only scsi-appearing device, change sr0 to sg0 and try again.
david
On Wed, 1 Nov 2000, Christoph Lechner wrote:
> Hallo,
>
> I've got my example source code from the SCSI-Programming-HOWTO. My IDE
> CD-ROM drive is
> /dev/sr0 (because of SCSI emulation). But why can I only open it
> readonly ?
--
David Weis | 10520 New York Ave, Des Moines, IA 50322
[EMAIL PROTECTED] | Voice 515-278-0133 Ext 231
| http://www.perfectionlearning.com/
When they took the Fourth Amendment, I was quiet because I didn't deal drugs.
When they took the Fifth Amendment, I was quiet because I was innocent.
When they took the Second Amendment, I was quiet because I didn't own a gun.
Now they've taken the First Amendment and I can't say anything.
------------------------------
From: [EMAIL PROTECTED] (Daniel Franklin)
Subject: Re: IP Masq Module Writing?
Reply-To: [EMAIL PROTECTED]
Date: 1 Nov 2000 16:08:01 +1100
Daniel Lenski wrote:
>Hi, I'm interested in writing an IP Masquerading Module to handle the
>SideCar authentication service used here at Cornell University. I was
>wondering if anyone knows of a good site where I can learn how to write
>an IP masq module. Thanks!
If you want to write a kernel module which will remain useful in the long
term, you probably want to look at Linux 2.4.0-test (currently test10) and
the netfilter stuff - it has been substantially changed for 2.4. You can get
the latest info at http://netfilter.kernelnotes.org.
Cheers,
- Daniel
--
******************************************************************************
* Daniel Franklin - Postgraduate student in Electrical Engineering
* University of Wollongong, NSW, Australia * [EMAIL PROTECTED]
******************************************************************************
------------------------------
Subject: KernelWiki for November: Dia de Muertos
From: Gary Lawrence Murphy <[EMAIL PROTECTED]>
Date: Wed, 01 Nov 2000 15:28:10 GMT
Yes kernel fans, it's Gary's nag-the-kernel-list time once again.
November 1 is "Dia de Muertos", the Day of the Dead, the time for
visiting tombstones and honouring our ancestors. A time when the dead
and gone can live through the words and deeds of the living.
The November 2000 KernelWiki Challenge is ...
"The _____ in the _____ subsystem implements the old _____."
1) Fill in the blanks, short and sweet, in your own words.
2) Go to http://kernelbook.sourceforge.net/wiki/?KernelWiki and find
the KernelWiki page covering your area of expertise.
3) Click the "Edit this Page" link
4) Plunk your November KernelWiki response into the text box.
5) Click "Save" and get back to your happy hacking.
It's painless. All I want is 10 minutes of your time. You know you
know the answers, and if you don't, you know the proper questions to
ask. I don't know how I can make it any easier. 10 minutes, 15 tops.
It takes longer to flame me for nagging, and contributing is more
positive.
No excuses. _Everyone_ has that kind of time to spare for Linux
documentation. There are hundreds of competent engineers active on
this list. One day's worth of our collective linux-kernel effort,
focused precisely on illuminating some part of the code, would
complete several chapters of text. A week's worth would fill a
thousand pages.
What do you win? Do it right, and you might cause that "transmission
of light" which nets you assistance in your kernel hacking. What
goes around, comes around. 'Karma' means 'action'.
WARNING: I am going to persist in nagging you to participate, but no
more than once a month ;) Chide me, ignore me, put me in your kill
file if you will but the KernelWiki _is_ working.
KernelWiki is a smash hit. KernelWiki is an overnight success.
KernelWiki has exceeded all expectations. KernelWiki is the latest
craze, the subject of folk songs and Paris fashions. Be the first in
your network segment to KernelWiki!
If you have more than 15 minutes to spare and you are interested in what
it is that I'm up to with this KernelWiki thing, you are invited to read
http://kernelbook.sourceforge.net/wiki/?KernelWikiWhy
http://kernelbook.sourceforge.net/wiki/?KernelWikiPolicies
http://kernelbook.sourceforge.net/wiki/?HowToUseWiki
The diligent are invited to cruise KernelWiki for question marks
and click the mark to describe the undefined term. KernelWiki
depends on your kind contributions.
See you in December ;)
--
Gary Lawrence Murphy <[EMAIL PROTECTED]>: office voice/fax: 01 519 4222723
T(!c)Inc Business Innovation through Open Source http://www.teledyn.com
M:I-3 - Documenting the Linux kernel: http://kernelbook.sourceforge.net
"My humanity is bound up in yours; we can only be human together"(Tutu)
------------------------------
From: [EMAIL PROTECTED] (Donovan Rebbechi)
Crossposted-To: comp.os.linux.development.apps,linux.redhat.rpm
Subject: Re: rpm build qt-2.2.1
Date: 1 Nov 2000 15:49:35 GMT
On Wed, 01 Nov 2000 10:03:04 +0100, O.Petzold wrote:
>That the last tail of the build process. I guess, there are should build. I
>had to change the
>spec file. I havn't a cp command which known the
>cp -frL include/. $RPM_BUILD_ROOT%{_libdir}/qt-%{version}/include
> ^
>syntax and I have a separate /tmp, /var, /usr/, /usr/src partitions.
>Where are my rpms ?
>File not found: /var/tmp/qt-root/usr/bin/findtr
>File not found: /var/tmp/qt-root/usr/bin/qt20fix
>File not found: /var/tmp/qt-root/usr/bin/qtrename140
The above seems to be your problem.
--
Donovan
------------------------------
From: [EMAIL PROTECTED] (Grant Edwards)
Crossposted-To: comp.os.linux.development.apps,comp.os.linux.questions
Subject: Re: Can I create a floppy with a simple Linux?
Date: Wed, 01 Nov 2000 16:09:44 GMT
In article <[EMAIL PROTECTED]>, hac wrote:
>> My main problem is not to get a small Linux distribution. My
>> problem is how to "create" a small Linux on a floppy by
>> "myself" or "manually".
There are step-by-step instructions in the Bootdisk-HOWTO.
>> For example, how to build a root file system on a RAM disk?
>> What is the boot sequence on a small Linux.
>http://www.linuxfromscratch.org/
>
>Tom's rt/bt has instructions on rebuilding new versions.
I tried building a custom version of tomsrtbt by following the
instructions provided (I wanted to add a single application)
and never got it to work.
--
Grant Edwards grante Yow! I HAVE a towel.
at
visi.com
------------------------------
** FOR YOUR REFERENCE **
The service address, to which questions about the list itself and requests
to be added to or deleted from it should be directed, is:
Internet: [EMAIL PROTECTED]
You can send mail to the entire list (and comp.os.linux.development.system) via:
Internet: [EMAIL PROTECTED]
Linux may be obtained via one of these FTP sites:
ftp.funet.fi pub/Linux
tsx-11.mit.edu pub/linux
sunsite.unc.edu pub/Linux
End of Linux-Development-System Digest
******************************