bug-commoncpp
[Top][All Lists]
Advanced

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

Re: Statically linked ELF, Process::detach() and serial port settings, s


From: David Sugar
Subject: Re: Statically linked ELF, Process::detach() and serial port settings, statically initialized ttystream
Date: Thu, 29 Apr 2004 10:21:01 -0400
User-agent: KMail/1.6.2

Detach performs a "fork".  I recall there is a fcntl which controls "close on 
exec", but is there a reset behavior for "fork" of an open tty device or some 
odd controlling terminal behavior being invoked since the original 
controlling terminal was dismissed and this device is open and available to 
"become" a controlling terminal?  Perhaps we need to add a ioctl(dev, 
TIOCNOTTY, NULL) after the device is opened in ttystream to assure it cannot 
become a controlling terminal when the console is dropped in detach?

On Thursday 29 April 2004 09:17 am, Onno Kortmann wrote:
> Hi,
>
> I wrote a small program that uses the serial port at 2400,8,n,1 to speak to
> a homebrewed microcontroller device and can/should be used as a daemon.
> Using the "ttystream" class with the extended initialization string (i.e.
> "/dev/ttyS2:2400,8,n,1") works without any problems, but only until I issue
> a Process::detach(). This seems to reset the port to 9600 baud or whatever
> it's initial setting was.
>
> The bug depends on a statically initialized ttystream. Maybe I overlooked
> something, but I didn't found anything in the docs (neither "the c++
> programming language" nor the common c++ docs) which states that statically
> initialized iostream objects are forbidden.
>
> I run the program as root under linux-2.4.18. I'm linking statically with
> these compile commands (because development box != box in production use
> for this case):
>
> g++ -g -Wall `ccgnu2-config --flags` -c baudtest.cc
> g++ -static -o baudtest baudtest.o `ccgnu2-config --gnulibs --extlibs`
>
> With this warning message (I ignored it because it seems to be really
> unrelated):
> /usr/lib/libccgnu2.a(inaddr.o)(.text+0x105b): In function
>
> `ost::InetAddress::getHostname() const':
> : warning: Using 'gethostbyaddr_r' in statically linked applications
> : requires
>
> at runtime the shared libraries from the glibc version used for linking
> /usr/lib/libccgnu2.a(inaddr.o)(.text+0xc30): In function
>
> `ost::InetAddress::setAddress(char const*)':
> : warning: Using 'gethostbyname_r' in statically linked applications
> : requires
>
> at runtime the shared libraries from the glibc version used for linking
>
> My libcommonc++2 version is the newest from testing/unstable:
> ii  libcommoncpp2- 1.0.13-3       Header files and static libraries for
> Common
>
> Attached is a short test program that works as expected only non-daemon
> mode (no cmdline arguments given).
>
> Admitted, the above is a somewhat weird configuration :) But a library
> should work as expected also under weird conditions - therefore I report
> this as a bug.
>
> Best regards,
>
> Onno




reply via email to

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