Linux-Development-Sys Digest #809, Volume #7 Fri, 28 Apr 00 01:13:14 EDT
Contents:
Nested directory structure problem ("Tomaz Leskovsek")
Re: How to force structure to byte alignment ? (Mattias Engdeg�rd)
Re: Struct size and allocate problem! need help. (Maruthi Vinjamuri)
Re: How to force structure to byte alignment ? (Grant Edwards)
SMBIOS and Linux 2.2.x ([EMAIL PROTECTED])
Re: Time for the MS-rats to desert (@ .)
Re: How to force structure to byte alignment ? (Kaz Kylheku)
ioremap() limitations? (jvirzi)
Re: ioremap() limitations? (David Weis)
Re: logging in as root over SSH (Peter Mardahl)
Re: logging in as root over SSH ([EMAIL PROTECTED])
Re: bz2 file (kartika garg)
file operations in kernel 2.2.12 ("Mike Ohlsen")
how Linux handles memory management (ing)
Re: How to replace NIC ("Mark Graybill")
Re: serial/parallel port programming... ("Mark Graybill")
Re: boot messages (Mario Klebsch)
Re: Booting linux on custom hardware. (Mario Klebsch)
----------------------------------------------------------------------------
From: "Tomaz Leskovsek" <[EMAIL PROTECTED]>
Subject: Nested directory structure problem
Date: Thu, 27 Apr 2000 19:14:07 +0200
Hi!
We have a web based web site construction tool. And we are having some
implementation problems. Looks like our nested directory structure that we
are using is causing system problems to our hosting provider.
For example: if your site name is tagtag.com\james then all your data is
stored in a directory structure \sites\j\a\m\james\ ! So we have 36
subdirectories under \sites (-, 0,...,z) and all of them have 36
subdirectories and all of them have 36 subdirectories. And next level is
user directory.
This structure is causing a lot of problems. Not to the file system, but to
some of utilities, like disk quota calculation.
Do you see any possible solution? A limit of subdirectories in directory on
Linux is around 65000 if I am not mistaken. We would like to somehow go
beyond this limit, so that we would be able to have many more user
directories accessible using URL like www.domain.com\user.
If this is not the right place to ask such a question, could you suggest
one? Thanks!
Regards,
Tomaz
------------------------------
From: [EMAIL PROTECTED] (Mattias Engdeg�rd)
Subject: Re: How to force structure to byte alignment ?
Date: 27 Apr 00 18:18:52 GMT
[EMAIL PROTECTED] (Kaz Kylheku) writes:
>On 27 Apr 2000 11:07:52 GMT, cschiu <[EMAIL PROTECTED]> wrote:
>>Dose everybody know how to force structure to byte alignment ?
>>Compile option ? or other method ?
>Using GCC, you can use the __attribute__ mechanism to control packing
>and alignment of individual members, or the structures that contain
>them.
While this is a useful hack for legacy code and can save a number of hours,
I would not use it for new code. Many compilers, but not all, have
something similar but the syntax (attributes, pragmas etc) and semantics
differ widely.
Since it is always possible to replace
T foo;
with
unsigned char foo[sizeof(T)];
and do the conversion yourself, this is preferable. Packed structs are
usually asked for in the context of binary file formats or network
protocols, and explicit declaration in terms of bytes makes it harder to
forget the endianness conversion :-)
And if saving space is the objective, the answer is to a) forget it,
b) plan your structs more wisely.
I was recently bitten by a bug in gcc 2.95.2 related to
__attribute__((packed)), which suggests that it uses less trodden code
paths in gcc.
------------------------------
From: Maruthi Vinjamuri <[EMAIL PROTECTED]>
Crossposted-To:
alt.os.linux,comp.os.linux.development.apps,comp.unix.sco.misc,comp.unix.sco.programmer,comp.unix.unixware.misc,tw.bbs.comp.linux
Subject: Re: Struct size and allocate problem! need help.
Date: Thu, 27 Apr 2000 15:31:36 -0400
If you are compiling the following program on Unixware 7.1.0 or
later systems, then try running cc with the following option with
cc.
cc -Zp1 <filename>
p1 Selects at least one byte alignment for all structure members;
or,
in other words, include no padding.
So, you should see 10 as the size of struct a.
Jaron wrote:
> Hi,
> I encounter a compiling program as below:
>
> struct a {
> unsigned char a1;
> unsigned char a2;
> unsigned short a3
> unsigned short a4
> unsigned long a5;
> };
>
> the structure size must be 10 but use sizeof print out is 12...
> I know this is the alignment problem of structure ..
> But how to resolve it ?
> I need to know the compiler option like -xx ?
> do anyone konw about this ?
------------------------------
From: grant@nowhere. (Grant Edwards)
Subject: Re: How to force structure to byte alignment ?
Date: Thu, 27 Apr 2000 20:02:40 GMT
In article <[EMAIL PROTECTED]>, Mattias Engdeg�rd wrote:
>I was recently bitten by a bug in gcc 2.95.2 related to
>__attribute__((packed)), which suggests that it uses less trodden code
>paths in gcc.
2.95.2 targetted for the ARM seems to gerate padding at the end
of the structure even with the packed attribute. There is no
space between fields, but sizeof still returns a larger number
than the sum of the sizes of all of the fields.
--
Grant Edwards grante Yow! I'd like some JUNK
at FOOD... and then I want to
visi.com be ALONE --
------------------------------
From: [EMAIL PROTECTED]
Subject: SMBIOS and Linux 2.2.x
Date: Thu, 27 Apr 2000 20:12:53 GMT
Is it possible to retrieve information from the SMBIOS in GNU/Linux?
I looked through the information on the /proc filesystem, but couldn't
get all the information I needed (like the Motherboard brand of the
system etc).
Thanks,
John Fjellstad
[EMAIL PROTECTED]
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Crossposted-To:
comp.os.linux.advocacy,comp.os.ms-windows.advocacy,comp.os.ms-windows.nt.advocacy,comp.os.linux.networking,comp.os.linux.security,comp.os.ms-windows.networking.tcp-ip,alt.conspiracy.area51
From: @ .
Subject: Re: Time for the MS-rats to desert
Date: Thu, 27 Apr 2000 20:40:16 GMT
In article <[EMAIL PROTECTED]>, John Unekis <[EMAIL PROTECTED]> wrote:
>@, . wrote:
>
>> You are a moron
>
>Oh, no, I'm wounded to the core. Such wit, such biting satire.
>Why I usually have to travel all the way to a bowling alley to hear such a
> clever
>put-down.
>
>What's the matter Mr. Gates, depressed over your stock prices?
>
Not a put down, just an observation.
------------------------------
From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: How to force structure to byte alignment ?
Reply-To: [EMAIL PROTECTED]
Date: Thu, 27 Apr 2000 20:53:50 GMT
On Thu, 27 Apr 2000 20:02:40 GMT, Grant Edwards <grant@nowhere.> wrote:
>In article <[EMAIL PROTECTED]>, Mattias Engdeg�rd wrote:
>
>>I was recently bitten by a bug in gcc 2.95.2 related to
>>__attribute__((packed)), which suggests that it uses less trodden code
>>paths in gcc.
>
>2.95.2 targetted for the ARM seems to gerate padding at the end
>of the structure even with the packed attribute. There is no
>space between fields, but sizeof still returns a larger number
>than the sum of the sizes of all of the fields.
A structure must contain padding at the end if it is required to satisfy the
alignment requirements for the first member of that structure. Otherwise arrays
of that struct type would not work right.
When the alignment is dictated by the hardware, it's not unreasonable for the
compiler to ignore the attributes; or at least just do its best while
satisfying the hardware constraints.
Allowing misaligned access to aligned datatypes would present a problem to the
compiler writer. Such accesses would have to be emulated by generating extra
code or using subroutines. Once you allow that, every access must be treated as
potentially misaligned: consider that you can take the address of any structure
member.
Some reasonable compromise might be to not allow the address of a misaligned
structure member to be lifted; thus only direct accesses to the member would
have to be fudged.
--
#exclude <windows.h>
------------------------------
From: jvirzi <[EMAIL PROTECTED]>
Subject: ioremap() limitations?
Date: Thu, 27 Apr 2000 17:40:53 -0700
I have a PCI device that requests 64MBytes ( yes, 64MEGABYTES ) of
memory. The BIOS successfully allocates that; no sweat there.
I use ioremap() to translate the physical address to a logical address.
int *pci_virt;
pci_phys = 0xf8000000; /* obtained from pci_dev */
pci_size = 64*1024*1024; /* obtained from pci_dev */
pci_virt = ioremap(pci_phys, pci_size);
printk("VIRT ADDRESS = %x\n", (int)pci_virt); /* prints out 0xCC05D000
*/
*pci_virt = 0; /* causes CRASH CRASH CRASH CRASH */
The last line cause the machine to hang up. Please bear in mind that the
numbers pci_phys and pci_size are obtained appropriately from pci dev
structures. They are just placed in the "code" above to show the
numbers.
Is there a limitation on the size of the region that a pointer returned
by ioremap(), can point to? Can anyone see something blatantly wrong
with the code?
------------------------------
From: David Weis <[EMAIL PROTECTED]>
Subject: Re: ioremap() limitations?
Date: Thu, 27 Apr 2000 20:10:06 -0500
On Thu, 27 Apr 2000, jvirzi wrote:
> I have a PCI device that requests 64MBytes ( yes, 64MEGABYTES ) of
> memory. The BIOS successfully allocates that; no sweat there.
>
> I use ioremap() to translate the physical address to a logical address.
>
> int *pci_virt;
> pci_phys = 0xf8000000; /* obtained from pci_dev */
> pci_size = 64*1024*1024; /* obtained from pci_dev */
> pci_virt = ioremap(pci_phys, pci_size);
> printk("VIRT ADDRESS = %x\n", (int)pci_virt); /* prints out 0xCC05D000
> */
> *pci_virt = 0; /* causes CRASH CRASH CRASH CRASH */
>
> The last line cause the machine to hang up. Please bear in mind that the
> numbers pci_phys and pci_size are obtained appropriately from pci dev
> structures. They are just placed in the "code" above to show the
> numbers.
I don't think you should be dereferencing the pointer directly, use
readb/writeb.
dave
--
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] (Peter Mardahl)
Subject: Re: logging in as root over SSH
Date: 28 Apr 2000 02:21:39 GMT
In article <[EMAIL PROTECTED]>,
Christopher Browne <[EMAIL PROTECTED]> wrote:
>>
>>> Does anyone see any particular reason why it wouldn't be?
>
>
>In contrast, if I'm required to log in as a "lower grade" user, then
>I either have to:
> a) Log in under my personal ID, in which case they've got a record
> that cbbrowne ran "su - root" and trashed the system, or
> b) Log in under someone else's ID. In which case I need to have
> already broken security by creating some hole in that "someone
> else's" ID.
>
>Does this prevent all exploits? No. But it eliminates the exploits
>that result from coming in "anonymously" as root.
I don't think this really helps much.
If Mr. Nefarious already has the root password, he can log in, su in,
do his nefarious deeds, and then delete the logs, or just remove
the evidence from the logs.
Unless of course, the machine logs to another machine. But that can
be circumvented very easily too.
Basically, you're mildly inconveniencing every legitimate use (log in,
SU), in order to mildly inconvenience an illegitimate use (hopefully rare).
I.e., you pay more than Mr. Nefarious in time for a tiny bit of security.
Using ssh in the first place, though, makes things a lot more inconvenient
for Mr. Nefarious than it does for you, ifhe doesn't already have
your root password.
PeterM
------------------------------
From: [EMAIL PROTECTED]
Subject: Re: logging in as root over SSH
Date: Fri, 28 Apr 2000 03:13:25 GMT
Peter Mardahl <[EMAIL PROTECTED]> wrote:
> Unless of course, the machine logs to another machine. But that can
> be circumvented very easily too.
Unless, of course, the machine logs use of SU to a hardcopy
terminal. ;)
> Basically, you're mildly inconveniencing every legitimate use (log in,
> SU), in order to mildly inconvenience an illegitimate use (hopefully rare).
It does provide two other useful benefits in some rare
circumstances. First, it prevents either the root password or key from
being exposed on another host. (ie, what if someone broke into the
machine you're sshing from and replaced ssh) And it's nice to know who
was root if you have multiple administrators that aren't nefarious,
just error prone. (ie, Who the hell wrote this stupid motd? ;)
--
Matt Gauthier <[EMAIL PROTECTED]>
------------------------------
From: kartika garg <[EMAIL PROTECTED]>
Subject: Re: bz2 file
Date: Fri, 28 Apr 2000 09:22:30 +0530
Nope I did it again.The length doesn't change neither when I download to windoze
nor when I ftp it to linux(using binary mode).Also in windoze it shows the correct
properties as archive and compressed. I downloaded by right-clicking on the link.
Anders Larsen wrote:
> kartika garg wrote:
> >
> > But I didn't ftp.I downloaded from the net.surely that should not make a
> > difference???
>
> Have you compared the length of the file on Windoze with that on Linux?
> (that is, did the file corruption occur as you downloaded to Windblows, or
> as you FTP'ed the file to linux)
>
> If the length did not change as you transferred the file to Linux, the
> corruption most probably occurred as you downloaded to Windows (in a browser?)
> You may try right-clicking the link (should force download to disk) instead
> of loading the thing into the browser window.
>
> The problem could also be with the server in question (or with an intermediate
> proxy); if no MIME type is specified for .bz2 files they might get sent as
> "plain/text" causing Windblows to perform a lethal LF->CR/LF conversion.
>
> OTOH, if the length did indeed change as you FTP'ed from Windows to Linux,
> then Robert has hit the point.
>
> > Robert Schiele wrote:
> >
> > > kartika garg wrote:
> > > >
> > > > Can you not download .bz2 files to windows.I have noticed that when I
> > > > download .bz2 files to windows and than ftp it to linux it gives an
> > > > error--"files are probably corrupt" but if I download them on linux then
> > > > there is no problem. Can somebody tell me the reason???
> > >
> > > Assure, your ftp client is set to binary mode!
> > > The Windows ftp client is normaly set to ascii mode which will corrupt
> > > binary code.
>
> --
> cheers
> Anders Larsen
> e-mail: alarsen AT baumerident DOT com
>
> Q: What does the CE in Windows CE stand for?
> A: Caveat Emptor
------------------------------
From: "Mike Ohlsen" <[EMAIL PROTECTED]>
Subject: file operations in kernel 2.2.12
Date: Fri, 28 Apr 2000 00:05:52 -0400
I am doing some char device driver writing and have a few questions about
the file operations for read and write. . .
The file device functions take four items as seen here:
static ssize_t device_read(
struct file *file,
char *buffer, /* The buffer to fill with the data */
size_t length, /* The length of the buffer */
loff_t *offset)
What exactly is the loff_t *offset? Is it an offset into the file (first
item passed in)? What does the offset point to?
In earlier kernel versions, the inode was passed into the read and write
functions, but in 2.2 and greater, it uses the offset. How do I use this
offset to get the inode pointer?
Thanks!!
------------------------------
From: ing <[EMAIL PROTECTED]>
Subject: how Linux handles memory management
Date: Fri, 28 Apr 2000 04:30:05 GMT
Hi,
I don't understand how Linux handles momory management. For example how
Linux control the Virtual memory, pagetable and etc.
Could you give me a basic explanation about this?
Thank you very much
--
Posted via CNET Help.com
http://www.help.com/
------------------------------
Reply-To: "Mark Graybill" <[EMAIL PROTECTED]>
From: "Mark Graybill" <[EMAIL PROTECTED]>
Subject: Re: How to replace NIC
Date: Fri, 28 Apr 2000 04:37:15 GMT
It's pretty standard today for NICs to be NE2000 compatible, or at least
configurable that way.
Linux supports NE2000 compatible NICs (module 'ne'.)
-Mark
bbyeung wrote in message ...
>I have an NIC that needs to be replaced. The problem is that I'm not sure
>whether the kernal running on my machine support the new drivers. In
>fact, the OS was setup by someone before me and I can't find any
>reference. Please advise how can I check my kernal version.
>
>--
>Posted via CNET Help.com
>http://www.help.com/
------------------------------
Reply-To: "Mark Graybill" <[EMAIL PROTECTED]>
From: "Mark Graybill" <[EMAIL PROTECTED]>
Subject: Re: serial/parallel port programming...
Date: Fri, 28 Apr 2000 04:45:33 GMT
I have used serial port hardware handshaking lines in the past (CTS, DSR,
DCD, RI) because of how easy it was (you have to cross them over to another
line: DTR I think.) You must make sure you have at least 50 ohms between
them so you don't short out the TTL circuits (just place a 50 ohm resister
in the path - you can get one from Radio Shack.)
If you need more than that, but 12 or less, just get a 4 port RS232 card
(provided you have enough interrupt lines free that the card supports.)
-Mark
Luke Bond wrote in message <[EMAIL PROTECTED]>...
>hi all,
>
>i'm beginning a project for which i want to develop a little circuit with
>some switches and buttons and dials, etc. and connect it up to the serial
or
>parallel port to use the components as triggers for part of my program.
>what i'm wondering is: am i better off using the serial or parallel port?
>where do i look for help? has anyone had success with this kinda thing? and
>am i posting to the right newsgroup?
>
>thanks in advance,
>-Luke
>
>
------------------------------
From: [EMAIL PROTECTED] (Mario Klebsch)
Subject: Re: boot messages
Date: Thu, 27 Apr 2000 22:36:15 +0200
Alan Donovan <[EMAIL PROTECTED]> writes:
>This is a perennial question, to which the answer is, sorry, there are
>no plans to make the bootup any prettier. Those messages are just so
>useful in understanding problems if they should arise that no-one who
>hacks that code is tempted to spend any effort making it prettier (i.e.
>harder to debug).
Although I know the value of those messages when debugging a system, I
often like to get rid of them, too. I would not mind having to use an
additional kernel option (like -v) to enable bootstrap verbosity.
73, Mario
--
Mario Klebsch [EMAIL PROTECTED]
------------------------------
From: [EMAIL PROTECTED] (Mario Klebsch)
Subject: Re: Booting linux on custom hardware.
Date: Thu, 27 Apr 2000 22:31:19 +0200
[EMAIL PROTECTED] writes:
>I am trying to boot linux on a custom-made board based on the 386ex
>processor. Could anyone point me to some usefull information??
>The obvious point would be to look at the sources of LILO, or some
>other boot loader to see what kind of "environment" is linux
>expecting to find when the kernel first starts.
AFAIK, Linux is able to boot in almost all situations. You can boot it
using LILO, but you can put the kernel on a floppy disk starting at
the boot sector and it woll start anyway. You even can load is over
the network.
Perhaps it is a good idea, to look at the etherboot stuff. They use a
special tagged file fomrat for booting. The tool used to create these
files is called mknbi-linux. These tagged images consist of several
part, where each part does have its own base (or load) address.
73, Mario
--
Mario Klebsch [EMAIL PROTECTED]
------------------------------
** 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
******************************