Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 May 2002 10:38:05 +0300
From:      Victor Ivanov <v0rbiz@icon.bg>
To:        freebsd-stable@freebsd.org
Subject:   pthread app from init (/etc/ttys)?
Message-ID:  <20020510103805.A99419@icon.icon.bg>

next in thread | raw e-mail | index | archive | help
Hi :)

I'm developing an pthread app which is run from init on a virtual tty (it's
not run from a user, it must be run automatically). Yesterday I upgraded to
4.6-PRERELEASE and the app started acting strangely.
The app has a screen-oriented UI, and it needs threads to do data
collecting and client/server communication "in the background" while
showing some nice window oriented interface.

To show the problem I've made a small app which opens the tty the same way
as getty does it.  First it chmod/chown/revokes it, the int opens it O_RDWR,
and then it calls login_tty to make it the controlling terminal, stdin,
stderr, stdout.

All works fine as long as the app is not compiled/linked -pthread. In the
latter case none of the initialization calls return error, but after that
input/output to the console returns 'Resource temporary unavailable'.

I've tried dup2-ing and TIOCSCTTY-ing and etc instead of using login_tty,
but the result is just the same.

I guess I should make some kind of wrapper app or start getty using
autologin and specifiying the app as the user's shell (which user must
be uid 0) ... but I really prefer the simple way.

Any hints/ideas/workarounds?

-- 
Players win and winners play
Have a lucky day

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020510103805.A99419>