let's try as a user with sufficient rights:
$ strace -f -ff -o STRACE_CU cu -l /dev/ttyS0 -s 115200
but it doesn't relay the serial console. i can abort this with the usual "~." if i have enough patience and if i break (^C) it a few times.
$ cat STRACE_CU.*|grep EPERM
Code:
ioctl(3, TIOCSCTTY) = -1 EPERM (Operation not permitted)
why isn't the actual terminal allowed to take control?
$ excerpt from STRACE_CU.*:
Code:
open("/dev/ttyS0", O_RDWR|O_NONBLOCK) = 3
geteuid32() = 1000
getuid32() = 1000
getegid32() = 1000
getgid32() = 1000
setregid32(1000, 1000) = 0
setreuid32(1000, 1000) = 0
fcntl64(3, F_GETFD) = 0
fcntl64(3, F_SETFD, FD_CLOEXEC) = 0
access("/dev/ttyS0", R_OK|W_OK) = 0
fcntl64(3, F_GETFL) = 0x802 (flags O_RDWR|O_NONBLOCK)
fcntl64(3, F_SETFL, O_RDWR) = 0
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 -opost -isig -icanon -echo ...}) = 0
ioctl(3, TCFLSH, 0) = 0
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 -opost -isig -icanon -echo ...}) = 0
ioctl(3, SNDCTL_TMR_START or TCSETS, {B115200 -opost -isig -icanon -echo ...}) = 0
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 -opost -isig -icanon -echo ...}) = 0
ioctl(3, TIOCSCTTY) = -1 EPERM (Operation not permitted)
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 -opost -isig -icanon -echo ...}) = 0
ioctl(3, SNDCTL_TMR_START or TCSETS, {B115200 -opost -isig -icanon -echo ...}) = 0
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 -opost -isig -icanon -echo ...}) = 0
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 -opost -isig -icanon -echo ...}) = 0
ioctl(3, SNDCTL_TMR_STOP or TCSETSW, {B115200 -opost -isig -icanon -echo ...}) = 0
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 -opost -isig -icanon -echo ...}) = 0
access("/dev/ttyS0", R_OK|W_OK) = 0
fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb77ca000
write(1, "\7Connected.\n", 12) = 12
ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(0, SNDCTL_TMR_START or TCSETS, {B38400 -opost -isig -icanon -echo ...}) = 0
ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 -opost -isig -icanon -echo ...}) = 0
pipe([4, 5]) = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb760e968) = 2670
close(5)
let's try with elevated rights:
$ sudo strace -f -ff -o SUDO_STRACE_CU cu -l /dev/ttyS0 -s 115200
Code:
cu: open (/dev/ttyS0): Permission denied
cu: /dev/ttyS0: Line in use
and it exits cleanly...
$ cat SUDO_STRACE_CU.*|grep "open"|grep "ttyS0"
Code:
open("/dev/ttyS0", O_RDWR|O_NONBLOCK) = -1 EACCES (Permission denied)
write(2, "cu: open (/dev/ttyS0): Permissio"..., 41) = 41
$ excerpt from SUDO_STRACE_CU.*
Code:
open("/dev/ttyS0", O_RDWR|O_NONBLOCK) = -1 EACCES (Permission denied)
geteuid32() = 10
getuid32() = 10
getegid32() = 0
getgid32() = 0
setregid32(0, 0) = 0
setreuid32(10, 10) = 0
write(2, "cu: open (/dev/ttyS0): Permissio"..., 41) = 41
unlink("/var/lock/LCK..ttyS0") = 0
write(2, "cu: /dev/ttyS0: Line in use\n", 28) = 28
exit_group(1) = ?
if anyone is interested in the full traces, just ask...
Bookmarks