LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-13-2018, 05:33 PM   #1
RandomTroll
Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 867

Rep: Reputation: 139Reputation: 139
A program to send a character to another tty fails in 64-bit


I wrote a small program to send a character to a terminal other than my own. I moved to 64-bit recently and the program fails.

I open a terminal with:
Code:
	hTTY = open(/dev/tty3, O_WRONLY|O_NONBLOCK);
then send a character with:
Code:
 result=ioctl(hTTY, TIOCSTI, argv[2]);
The open succeeds but the ioctl fails with errno=1, Operation not permitted.

If I send to its own tty it works. Ownership and permissions of the target terminal don't matter. If I do it as root it works.
What's the difference between 32 and 64 bit?
 
Old 06-14-2018, 12:42 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: CentOS 6 & 7
Posts: 2,949

Rep: Reputation: 789Reputation: 789Reputation: 789Reputation: 789Reputation: 789Reputation: 789Reputation: 789
Most likely you are hitting capabilities. My guess would be you need CAP_SYS_TTYCONFIG.

http://man7.org/linux/man-pages/man7...ilities.7.html
 
1 members found this post helpful.
Old 06-14-2018, 01:49 PM   #3
RandomTroll
Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 867

Original Poster
Rep: Reputation: 139Reputation: 139
Quote:
Originally Posted by smallpond View Post
Most likely you are hitting capabilities. My guess would be you need CAP_SYS_TTYCONFIG.
Thanks. I didn't know about this; BTW it's CAP_SYS_TTY_CONFIG. I wrote the program a few years ago. I worked until I switched to 64-bit, same kernel version.
 
Old 06-15-2018, 02:24 PM   #4
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,156

Rep: Reputation: 698Reputation: 698Reputation: 698Reputation: 698Reputation: 698Reputation: 698
You updated system to 64 bits keeping same group settings for user?
 
Old 06-16-2018, 09:36 AM   #5
RandomTroll
Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 867

Original Poster
Rep: Reputation: 139Reputation: 139
Quote:
Originally Posted by keefaz View Post
You updated system to 64 bits keeping same group settings for user?
Yes.
 
Old 06-16-2018, 01:19 PM   #6
RandomTroll
Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 867

Original Poster
Rep: Reputation: 139Reputation: 139
Setting the sticky bit makes it work.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
64 bit Wine and 64 bit Windows applications. SketchUp 2015/16 64 bit install fails. bamunds Slackware 2 03-23-2016 08:42 PM
^@ character while using TTY anwar-it0 Arch 1 04-16-2014 07:17 AM
BASH Script, printing character to tty (simulating key press?) lupusarcanus Programming 3 03-20-2011 07:23 AM
[SOLVED] odd character string while booting or in tty cjokinen Linux - Laptop and Netbook 3 12-30-2009 09:48 AM
How do you change how many spaces contains a TAB character in the console (tty) ? zahadumy Linux - Software 2 05-18-2006 02:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration