From owner-freebsd-stable Fri May 10 0:38:15 2002 Delivered-To: freebsd-stable@freebsd.org Received: from icon.bg (icon.bg [62.176.80.58]) by hub.freebsd.org (Postfix) with ESMTP id 4F6B437B405 for ; Fri, 10 May 2002 00:38:10 -0700 (PDT) Received: (qmail 99554 invoked by uid 1000); 10 May 2002 07:38:06 -0000 Date: Fri, 10 May 2002 10:38:05 +0300 From: Victor Ivanov To: freebsd-stable@freebsd.org Subject: pthread app from init (/etc/ttys)? Message-ID: <20020510103805.A99419@icon.icon.bg> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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