Linux-Development-Apps Digest #422, Volume #7    Tue, 22 May 01 00:13:11 EDT

Contents:
  Re: Makefiles (Roger Leigh)
  gcc option (Saurabh Desai)
  Re: Mutex (Kaz Kylheku)
  Re: Mutex (Kaz Kylheku)
  Re: How to get rid of 'tempnam is dangerous' warning? (David Konerding)
  Re: gcc option (Russell & Kristal Suter)
  Re: gui for linux (Kaz Kylheku)
  child process - new console ("Ross Mills")
  Re: How to get rid of 'tempnam is dangerous' warning? (Kaz Kylheku)
  Re: child process - new console (Jim Cochrane)
  Where to get Redhat Info (Todd Cary)
  Re: Where to get Redhat Info ("Arthur H. Gold")
  Re: Moving from Motif to... (Victor Wagner)
  Re: How to get rid of 'tempnam is dangerous' warning? (Grant Edwards)
  Re: How to get rid of 'tempnam is dangerous' warning? (Grant Edwards)
  Re: How to get rid of 'tempnam is dangerous' warning? (Grant Edwards)
  Re: Moving from Motif to... (Yury Petrov)
  Re: How to get rid of 'tempnam is dangerous' warning? (Kaz Kylheku)
  Re: How to get rid of 'tempnam is dangerous' warning? (John Reiser)
  Re: How to get rid of 'tempnam is dangerous' warning? (Grant Edwards)

----------------------------------------------------------------------------

From: Roger Leigh <[EMAIL PROTECTED]>
Subject: Re: Makefiles
Date: 20 May 2001 23:06:58 +0100

roald osinga <[EMAIL PROTECTED]> writes:

> Hi there,
> 
> is there anybody who can provide me a link to a kind of Makefile HOWTO.
> I want to UNDERSTAND how to and why in this way build correct makefiles
> and provide a configure.

For writing Makefile files, the GNU make Info documentation is very
good.  For writing `configure' scripts, see the GNU autoconf Info
doc.  If you use autoconf, you can use automake to automate Makefile
creation (also an Info doc).

-- 
Roger Leigh ** Registration Number: 151826, http://counter.li.org **
Need Epson Stylus Utilities? http://gimp-print.sourceforge.net/
For GPG Public Key: finger [EMAIL PROTECTED] or see public keyservers.

------------------------------

From: Saurabh Desai <[EMAIL PROTECTED]>
Subject: gcc option
Date: Mon, 21 May 2001 17:28:44 -0500


Is there an option in gcc to see all included files 
when you compile a program? Sometimes one include file
includes other and that goes on. So, to see all filenames,
I like to use this option.

Thanks.

------------------------------

From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: Mutex
Reply-To: [EMAIL PROTECTED]
Date: Mon, 21 May 2001 23:04:33 GMT

On Mon, 21 May 2001 17:34:03 +0800, Piscean <[EMAIL PROTECTED]> wrote:
>Hi,I know that Mutex can implement multi-processes access on shared
>resource.Now,while a mutex is signaled,I want multi-processes to run in same
>time.Can it be implemented?

What are you talking about? What does it mean for a mutex to be signaled?  A
mutex has two states: locked (owned by a specific task) or unlocked (not owned
by any task).  The term mutex is a contraction of MUT-ual EX-clusion.  A mutex
does not interfere with the ability of tasks to execute in parallel, except
when there is a contention for the lock. Then the mutex inserts delays into the
execution of tasks so that mutual exclusion is achieved.

------------------------------

From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: Mutex
Reply-To: [EMAIL PROTECTED]
Date: Mon, 21 May 2001 23:05:08 GMT

On Mon, 21 May 2001 05:58:55 -0400, Frank V. Castellucci
<[EMAIL PROTECTED]> wrote:
>Piscean wrote:
>> 
>> Hi,I know that Mutex can implement multi-processes access on shared
>> resource.Now,while a mutex is signaled,I want multi-processes to run in same
>> time.Can it be implemented?
>> 
>> Regards,
>> Piscean
>
>Yes, although this may sometimes be refered to as an Event semaphore.

Sometimes being ``when you are programming under Win32''.

------------------------------

From: [EMAIL PROTECTED] (David Konerding)
Subject: Re: How to get rid of 'tempnam is dangerous' warning?
Date: 21 May 2001 22:26:45 GMT
Reply-To: [EMAIL PROTECTED]

On Mon, 21 May 2001 21:52:15 GMT, Grant Edwards <[EMAIL PROTECTED]> wrote:
> How do I get rid of the 'tempnam is dangerous' warning?  
> 
> Is there a pragma I can use to turn off that warning?
> 
> The man pages (and the fcc warning message) all say to use
> mkstmp() instead of tempnam(), but the mkstemp()'s semantics
> aren't the same, so I can't use it.
> 
> I'd really like to have a clean compile with -Wall before
> shipping the product, and the tempnam warning is the last
> one...

Your logic makes no sense to me.  You want a clean compile, but
it's a valid warning.  Using a pragma to turn off the warning doesn't
make the problem (tempnam is "dangerous") go away.  If you're willing
to accept that fact, then you are free to use it, and ignore the message.
I mean, what's the point of a "clean compile" if you're just hiding problems?

Dave

------------------------------

Date: Mon, 21 May 2001 17:17:25 -0600
From: Russell & Kristal Suter <[EMAIL PROTECTED]>
Subject: Re: gcc option

Saurabh Desai wrote:

> Is there an option in gcc to see all included files
> when you compile a program? Sometimes one include file
> includes other and that goes on. So, to see all filenames,
> I like to use this option.
>
> Thanks.

There are the -M* options for generating dependencies.


------------------------------

From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: gui for linux
Reply-To: [EMAIL PROTECTED]
Date: Mon, 21 May 2001 23:21:41 GMT

On Mon, 21 May 2001 14:17:02 GMT, Grant Edwards <[EMAIL PROTECTED]> wrote:
>In article <[EMAIL PROTECTED]>, Nils O. Selåsdal wrote:
>>
>>Or why not use the X libraries directly ?
>
>I don't know if you've done xlib programming, but it's pretty
>brutal.  I've no idea why somebody would use xlib directly
>rather than something like gtk.

``Something like gtk'' being X Toolkit Intrinsics and X Athena Widgets maybe?
These are the stuff of traditional X programming. When someone says
``X libraries'', presumably these things are included, not just Xlib.

If you go lower than the toolkit, then you have to implement your GUI
primitives from absolute scratch.  E.g.  draw rectangles to represent buttons,
test which rectangle you are in when a mouse button is pressed, etc.  :)

------------------------------

From: "Ross Mills" <[EMAIL PROTECTED]>
Subject: child process - new console
Date: Mon, 21 May 2001 23:22:23 GMT

Hi,

How can I create a child process that runs in a separate console.  (Redhat
Linux 6.2)

Thanks,
Ross Mills



------------------------------

From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: How to get rid of 'tempnam is dangerous' warning?
Reply-To: [EMAIL PROTECTED]
Date: Mon, 21 May 2001 23:25:42 GMT

On Mon, 21 May 2001 21:52:15 GMT, Grant Edwards <[EMAIL PROTECTED]> wrote:
>How do I get rid of the 'tempnam is dangerous' warning?  
>
>Is there a pragma I can use to turn off that warning?
>
>The man pages (and the fcc warning message) all say to use
>mkstmp() instead of tempnam(), but the mkstemp()'s semantics
>aren't the same, so I can't use it.
>
>I'd really like to have a clean compile with -Wall before
>shipping the product, and the tempnam warning is the last
>one...

If your program is ANSI C, use tmpfile() instead. It opens a temporary
file and returns a FILE * pointer. This is quite easy to use, because
you don't have to deal with the temporary name at all, and it handles
deleting the file when your program terminates, or when the stream
is closed.

------------------------------

From: [EMAIL PROTECTED] (Jim Cochrane)
Subject: Re: child process - new console
Date: 21 May 2001 17:31:41 -0600

If you are running X, one possibility is to start an xterm with the -e
option (man xterm).  If you want the process's io to be bound to a
different physical console, that will be harder to do (if it's possible).
Is that what you are looking for?  If so, I'll leave it up to someone more
expert in systems programming to give you an answer.

In article <PqhO6.7235$[EMAIL PROTECTED]>,
Ross Mills <[EMAIL PROTECTED]> wrote:
>Hi,
>
>How can I create a child process that runs in a separate console.  (Redhat
>Linux 6.2)
>
>Thanks,
>Ross Mills
>
>


-- 
Jim Cochrane
[EMAIL PROTECTED]

------------------------------

From: Todd Cary <[EMAIL PROTECTED]>
Subject: Where to get Redhat Info
Date: Tue, 22 May 2001 00:38:35 GMT

What is the best Group to get RedHat info?

Many thanks.....

Todd

--
Todd Cary
Ariste Software
[EMAIL PROTECTED]



------------------------------

Date: Mon, 21 May 2001 20:55:03 -0500
From: "Arthur H. Gold" <[EMAIL PROTECTED]>
Subject: Re: Where to get Redhat Info

Todd Cary wrote:
> 
> What is the best Group to get RedHat info?
> 
> Many thanks.....
> 
> Todd
> 
Probably news:linux.redhat

If your news server does not carry it, either try a different one or
consult RH's web pages.

HTH,
--ag
-- 
Artie Gold, Austin, TX  (finger the cs.utexas.edu account for more info)
mailto:[EMAIL PROTECTED] or mailto:[EMAIL PROTECTED]
--
I am looking for work. Contact me.

------------------------------

From: [EMAIL PROTECTED] (Victor Wagner)
Subject: Re: Moving from Motif to...
Date: 21 May 2001 09:10:54 +0400

Yury Petrov <[EMAIL PROTECTED]> wrote:
: Hello,

: There is the Motif 2.1 application with source code (pure C). The
: application is big enough (couple of Mloc).
: There is the wish to port it to some non-Motif X.

  But why?
  
: So the questions are:
: 1. What will you suggest as "non-Motif" X? gtk, Qt something else?

 In my opinion gtk is much worse than motif, for instance it has
 internationalization problems. Qt is not an option at all, becouse
 it is C++ only.





-- 
One of the signs of Napoleon's greatness is the fact that he once had a
publisher shot.
                -- Siegfried Unseld

------------------------------

From: [EMAIL PROTECTED] (Grant Edwards)
Subject: Re: How to get rid of 'tempnam is dangerous' warning?
Date: Tue, 22 May 2001 02:27:20 GMT

On Mon, 21 May 2001 23:25:42 GMT, Kaz Kylheku <[EMAIL PROTECTED]> wrote:

>>How do I get rid of the 'tempnam is dangerous' warning?  
>>
>>Is there a pragma I can use to turn off that warning?
>>
>>The man pages (and the fcc warning message) all say to use
>>mkstmp() instead of tempnam(), but the mkstemp()'s semantics
>>aren't the same, so I can't use it.
>>
>>I'd really like to have a clean compile with -Wall before
>>shipping the product, and the tempnam warning is the last
>>one...
>
>If your program is ANSI C, use tmpfile() instead. It opens a
>temporary file and returns a FILE * pointer.

I don't wat a FILE pointer, I want a name.  That's why I said
that I need the semantics of tempnam rather than mkstemp().
Actually I want a file descriptor for a character device with a
particular major/minor number, but I'm resigned to doing the
mknod() once I get a temporary file name.

>This is quite easy to use, because you don't have to deal with
>the temporary name at all, and it handles deleting the file
>when your program terminates, or when the stream is closed.

That would be fine if I wanted a stream. :)

-- 
Grant Edwards                   grante             Yow!  I'm RELIGIOUS!! I
                                  at               love a man with a
                               visi.com            HAIRPIECE!! Equip me with
                                                   MISSILES!!

------------------------------

From: [EMAIL PROTECTED] (Grant Edwards)
Subject: Re: How to get rid of 'tempnam is dangerous' warning?
Date: Tue, 22 May 2001 02:34:42 GMT

On 21 May 2001 22:26:45 GMT, David Konerding <[EMAIL PROTECTED]> wrote:

>> How do I get rid of the 'tempnam is dangerous' warning?  
>> 
>> Is there a pragma I can use to turn off that warning?
>> 
>> The man pages (and the fcc warning message) all say to use
>> mkstmp() instead of tempnam(), but the mkstemp()'s semantics
>> aren't the same, so I can't use it.
>> 
>> I'd really like to have a clean compile with -Wall before
>> shipping the product, and the tempnam warning is the last
>> one...
>
>Your logic makes no sense to me.  You want a clean compile, but
>it's a valid warning.

Why is it a valid warning?  

According to the man page, the function does pretty much
exactly what I want to do -- the described semantics are
exactly what I need to do.  The man pages says to never use
this function but it doesn't say why. I suppose I could write
my own function to generate a temporary file name, but it seems
a bit redundant.

>Using a pragma to turn off the warning doesn't
>make the problem (tempnam is "dangerous") go away.

What problem.  Can somebody explain the "danger" I'm facing?

>If you're willing to accept that fact, then you are free to use
>it, and ignore the message.

I make a point of eliminating all compiler warnings before I
ship code.  I'd like to eliminate that one, and I don't see any
way of generating a temporary file name than tempnam().

>I mean, what's the point of a "clean compile" if you're just
>hiding problems?

What problem would I be hiding?  

Can you suggest a better way to generate a temporary file name
that isn't "dangerous" like tempnam?

-- 
Grant Edwards                   grante             Yow!  .. I wonder if I
                                  at               ought to tell them about my
                               visi.com            PREVIOUS LIFE as a COMPLETE
                                                   STRANGER?

------------------------------

From: [EMAIL PROTECTED] (Grant Edwards)
Subject: Re: How to get rid of 'tempnam is dangerous' warning?
Date: Tue, 22 May 2001 02:39:35 GMT

On Mon, 21 May 2001 21:52:15 GMT, Grant Edwards <[EMAIL PROTECTED]> wrote:

>How do I get rid of the 'tempnam is dangerous' warning?  
>
>Is there a pragma I can use to turn off that warning?

Why is it that in the Linux newsgroups you can never get a
simple answer to a simple question.  You ask a straight-forward
question "can/how do I do X." The answers are always of the
form "You don't want to do X, you should do Y." After three
more postings justifying your reasons for needed to do X, you
finally get an answer: "Uh, I don't know how to do X, but I do
know how to do Y -- are you sure you don't want to do Y?"

-- 
Grant Edwards                   grante             Yow!  I wish I was a
                                  at               sex-starved manicurist
                               visi.com            found dead in the Bronx!!

------------------------------

From: Yury Petrov <[EMAIL PROTECTED]>
Subject: Re: Moving from Motif to...
Date: Tue, 22 May 2001 02:42:21 GMT



Victor Wagner wrote:

> <...>
>
> : There is the Motif 2.1 application with source code (pure C). The
> : application is big enough (couple of Mloc).
> : There is the wish to port it to some non-Motif X.
>
>   But why?

Because Motif is ugly. ( I apologize in advance if this statement hurts
anybody ;)

> : So the questions are:
> : 1. What will you suggest as "non-Motif" X? gtk, Qt something else?
>
>  In my opinion gtk is much worse than motif, for instance it has
>  internationalization problems.

Wow?! Never heard. What sort of problems?



--
YP



------------------------------

From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: How to get rid of 'tempnam is dangerous' warning?
Reply-To: [EMAIL PROTECTED]
Date: Tue, 22 May 2001 03:08:08 GMT

On Tue, 22 May 2001 02:39:35 GMT, Grant Edwards <[EMAIL PROTECTED]> wrote:
>On Mon, 21 May 2001 21:52:15 GMT, Grant Edwards <[EMAIL PROTECTED]> wrote:
>
>>How do I get rid of the 'tempnam is dangerous' warning?  
>>
>>Is there a pragma I can use to turn off that warning?
>
>Why is it that in the Linux newsgroups you can never get a
>simple answer to a simple question.  You ask a straight-forward
>question "can/how do I do X." The answers are always of the
>form "You don't want to do X, you should do Y." After three

Sometimes that is the right answer.

>more postings justifying your reasons for needed to do X, you
>finally get an answer: "Uh, I don't know how to do X, but I do
>know how to do Y -- are you sure you don't want to do Y?"

In this case, the programming tools themselves are telling you that X is
dangerous. The only way to get rid of that is to build your own glibc from
scratch, after editing out the link warning.

It has now become apparent that what you really want is to solve a problem Z:
creating a unique device entry in the filesystem, with a specified major and
minor number.

I don't think that this problem is adquately solved by any of the standard C
and POSIX functions, which are geared toward the acquisition of a temporary
file. They divide into two groups: ones which give you the name of a file which
was known not to exist sometime before the function returned, and those which
actually open the unique file and give it to you, presumably using a well
debugged algorithm implemented by someone with a clue. ;) The former have race
conditions and some other issues.  The latter are useless to you because you
want to create a temporary device rather than a temporary file, something that
you did not make clear at the outset.

The solution is to roll your own generating function.  Since you are going
to attempt to mknod() with that name, the name generating function does
not have to to perform any filesystem access at all.  Just pick some
prefix, and sprintf() the thing together with an incrementing counter.

Actually, are you sure you need to generate a temporary device node? 
Maybe you really don't want to to Z, but rather W ...

------------------------------

From: John Reiser <[EMAIL PROTECTED]>
Subject: Re: How to get rid of 'tempnam is dangerous' warning?
Date: Mon, 21 May 2001 20:21:09 -0700

> How do I get rid of the 'tempnam is dangerous' warning?

Use a compiler/libraries/linker that does not care.
Or, use a filter which discards the message.

> Is there a pragma I can use to turn off that warning?

No.

-- 
John Reiser, [EMAIL PROTECTED]

------------------------------

From: [EMAIL PROTECTED] (Grant Edwards)
Subject: Re: How to get rid of 'tempnam is dangerous' warning?
Date: Tue, 22 May 2001 03:46:12 GMT

On Tue, 22 May 2001 03:08:08 GMT, Kaz Kylheku <[EMAIL PROTECTED]> wrote:

>Actually, are you sure you need to generate a temporary device
>node? 

It seems to be the easiest thing to do.

The code in question is in a daemon that needs to interact with
a kernel module that uses a dynamically allocated major number.

I parse /proc/devices to find the major number, and then I need
to create a node that I can open() and do ioctl()s on to
initialize and control the driver module.

I use tempnam() to generate a temporary name.  Using that name
I then do mknod(),open(),unlink().  Using the file descriptor
from open() I do some ioctl() calls to download configuration
data into the driver and perform control operations.

>Maybe you really don't want to to Z, but rather W ...

One alternative would be to use a /proc filesystem entry to
write configuation data to the driver.  /proc handlers
traditionally deal with ASCII text, and I don't really want to
put all of the configuration parsing code in kernel-space.

Though the /proc entry could work for configuration data, some
of the control operations would be difficult since they need to
pass a TCP socket to the driver module so that it can do
various strange and wonderful things with the socket.  These
operations are generally blocking and return some sort of
status to the daemon.

-- 
Grant Edwards                   grante             Yow!  TONY RANDALL! Is YOUR
                                  at               life a PATIO of FUN??
                               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 by posting to the
comp.os.linux.development.apps newsgroup.

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-Apps Digest
******************************

Reply via email to