Unix Modem Opns

Alex Martelli staff at cadlab.sublink.ORG
Sat Apr 7 08:22:37 AEST 1990

> get by the carrier detect problem but I cannot get into a O_RDWR mode with the 
> /dev/tty** file that the modem is hooked up to, because it is "-rw--w--w-" 
> character file.  This has to be able to be done because CU can get into a 
> read-write mode 
> (terminal mode) with the modem.

CU is generally owned by user uucp, as is /dev/ttywhatever, and CU is a
setuid program, so that anybody running it will have effective-userid of
uucp, thus "own" the port... you MIGHT be able to get your program chown'ed
to uucp and setuid as well (you'll have to talk with your sysadm), or a
softer solution might be to make the port -rw-rw--w-, owned by some
group, and let your executable be setgid to that.  A very kludgey 
solution, which works in some cases, is to fork-and-exec good old CU
itself, piping its I/O to/from your program as appropriate... maybe OK
to read/write an S-register or two, but definitely not a general solution!

The kludge is the only thing that might avoid dealing with the sysadm,
however (me, I'm having trouble enough with serial comms under Unix even
though I can su, chown and chmod all I want...!).  Good luck.
Alex Martelli - CAD.LAB s.p.a., v. Stalingrado 45, Bologna, Italia
Email: (work:) staff at cadlab.sublink.org, (home:) alex at am.sublink.org
Phone: (work:) ++39 (51) 371099, (home:) ++39 (51) 250434; 
Fax: ++39 (51) 366964 (work only; any time of day or night).

More information about the Comp.lang.c mailing list