sg(4)

sg4

Linux ioctl-compatible scsi passthru device

Usage

device sg device scbus

Overview

The sg driver provides a Linux compatible scsi passthru device. This driver attaches to all cam(4) peripheral devices. It is similar to the pass(4) device, but uses the Linux interfaces, rather than the FreeBSD CAM interfaces.

Ioctl

The following subset of the Linux sg ioctl interfaces are implemented:

SG_SET_TIMEOUT

u_int, to Set the timeout in milliseconds.

SG_GET_TIMEOUT

Get the timeout in milliseconds

SG_GET_RESERVED_SIZE

u_int Returns the size of the I/O one can do this device.

SG_GET_SCSI_ID

struct, sg_scsi_id Returns the bus number, channel, scsi bus ID number, lun and other information about the SCSI device.

SG_GET_SG_TABLESIZE

u_int Returns the table size, though hard wired to 0.

SG_GET_VERSION_NUM

u_int Return the version number that is implemented.

SG_IO

struct, sg_io_hdr

All other ioctl interfaces return ENODEV.

Files

/dev/sg*

Passthru devices.

Releases

Unchanged in 7 releases since FreeBSD 14.2-RELEASE.

  1. 14.2–16.0

History

The sg driver first appeared in FreeBSD 7.0.

From base 16.0-CURRENT-20261027-61c70dc16a79 in FreeBSD 16.0-CURRENT (2026-10-27). Parsed by carta from the page's mdoc source.