FreeBSD Handbook : Serial Communications : Dialin Service : Device Special Files
Previous: Kernel Configuration
Next: Configuration Files

14.3.4. Device Special Files

Most devices in the kernel are accessed through ``device special files'', which are located in the /dev directory. The sio devices are accessed through the /dev/ttyd? (dial-in) and /dev/cua0? (call-out) devices. On FreeBSD version 1.1.5 and higher, there are also initialization devices (/dev/ttyid? and /dev/cuai0?) and locking devices (/dev/ttyld? and /dev/cual0?). The initialization devices are used to initialize communications port parameters each time a port is opened, such as crtscts for modems which use CTS/RTS signaling for flow control. The locking devices are used to lock flags on ports to prevent users or programs changing certain parameters; see the manual pages termios(4), sio(4), and stty(1) for information on the terminal settings, locking & initializing devices, and setting terminal options, respectively.

14.3.4.1. Making Device Special Files

A shell script called MAKEDEV in the /dev directory manages the device special files. (The manual page for MAKEDEV(8) on FreeBSD 1.1.5 is fairly bogus in its discussion of COM ports, so ignore it.) To use MAKEDEV to make dialup device special files for COM1: (port 0), cd to /dev and issue the command MAKEDEV ttyd0. Likewise, to make dialup device special files for COM2: (port 1), use MAKEDEV ttyd1.

MAKEDEV not only creates the /dev/ttyd? device special files, but also creates the /dev/cua0? (and all of the initializing and locking special files under FreeBSD 1.1.5 and up) and removes the hardwired terminal special file /dev/tty0?, if it exists.

After making new device special files, be sure to check the permissions on the files (especially the /dev/cua* files) to make sure that only users who should have access to those device special files can read & write on them - you probably do not want to allow your average user to use your modems to dialout. The default permissions on the /dev/cua* files should be sufficient:

crw-rw----    1 uucp     dialer    28, 129 Feb 15 14:38 /dev/cua01
crw-rw----    1 uucp     dialer    28, 161 Feb 15 14:38 /dev/cuai01
crw-rw----    1 uucp     dialer    28, 193 Feb 15 14:38 /dev/cual01

These permissions allow the user uucp and users in the group dialer to use the call-out devices.


FreeBSD Handbook : Serial Communications : Dialin Service : Device Special Files
Previous: Kernel Configuration
Next: Configuration Files