bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: a question on du.c and df.c rather than a statement of a bug


From: Eric Blake
Subject: Re: a question on du.c and df.c rather than a statement of a bug
Date: Wed, 14 Mar 2007 07:35:12 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.10) Gecko/20070221 Thunderbird/1.5.0.10 Mnenhy/0.7.4.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to )\(@sS on 3/14/2007 6:47 AM:
             ^^^^^^
Your preferred name is awkward; you should enclose it in "" so that email
clients don't choke on it.

> Hello there,
> i am trying to use both the du functionality and the df one in my code in
> order to do some memory management.
> basically i have generated the object files df.o and du.o from the
> corresponding du.c and df.c that i got from the package fileutils-4.1 .

fileutils is old; it was merged into coreutils, and the latest version is
6.8.  I would recommend getting the newer sources and starting from there,
so that you can pick up bug fixes made in the meantime.

> 
> of course, slight tweaking was necessary in order to extract the needed
> value (the corresponding main(){} were changed since they would no
> longer be
> used on their own).
> then i retrieve the outcome of df from "available" and the outcome of du
> from "tot_size". (you should assume that the rest of the source has not
> been
> tampered with)

If you are linking df.o and du.o into your own code, then distributing
your resulting executable, then your code needs to be licensed under the
GPL and needs to be available alongside your distributed binary.  Be
careful that you are not violating any copyright laws by your actions.
But other than that caveat, the point of open source is to promote reuse,
so you are welcome to use the coreutils sources to help you in your problem.

> 
> so i have compiled only and i am now linking directly the du.o and df.o in
> my code.
> the problem is that when both objects are linked in i get faulty returned
> values for both of them. if only one object is present at a time i get the
> right result for the object file that was used.

If you expect help from this list, you will have to provide more details
than that.  Otherwise, since you have the source code to df and du, you
should be able debug this yourself.

One other thing to consider.  du.o and df.o were not designed to be linked
together; they were designed for separate utilities.  But both of them
link against the same library for their underlying algorithms.  Maybe it
is better worth your time to just directly use the fts() function and
other goodies from the gnulib project, bypassing the overhead of df and du.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF9/oQ84KuGfSFAYARAgvKAKDWBPcyVXDMuAUKJmHiHSjqPSgxbwCcDDsI
yze9CbrhG2Rxp3b+nuOU6ok=
=NAnI
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]