# Alternative of sg.h



## Neeraj Singh (May 9, 2016)

We are using the sg.h in development.
On other Linux flavours we are able to get the header files in system.
But in free bsdFreeBSD system,we are unable to locate it system directory.


```
error: unknown type name 'sg_io_hdr_t'
:664:22: error: 'SG_GET_VERSION_NUM' undeclared (first use in this function)
:664:22: note: each undeclared identifier is reported only once for each function it appears in
:671:30: error: 'sg_io_hdr_t' undeclared (first use in this function)
:672:10: error: request for member 'interface_id' in something not a structure or union
:673:10: error: request for member 'cmd_len' in something not a structure or union
:675:10: error: request for member 'mx_sb_len' in something not a structure or union
:676:10: error: request for member 'dxfer_direction' in something not a structure or union
:676:29: error: 'SG_DXFER_FROM_DEV' undeclared (first use in this function)
:677:10: error: request for member 'dxfer_len' in something not a structure or union
:678:10: error: request for member 'dxferp' in something not a structure or union
:679:10: error: request for member 'cmdp' in something not a structure or union
:680:10: error: request for member 'sbp' in something not a structure or union
:681:10: error: request for member 'timeout' in something not a structure or union
:683:21: error: 'SG_IO' undeclared (first use in this function)
:691:15: error: request for member 'info' in something not a structure or union
:691:23: error: 'SG_INFO_OK_MASK' undeclared (first use in this function)
:691:43: error: 'SG_INFO_OK' undeclar
```

Can anybody help on this??


----------



## SirDice (May 9, 2016)

Neeraj Singh said:


> On other Linux flavours we are able to get the header files in system.


FreeBSD is NOT a "Linux flavor".


----------



## ondra_knezour (May 9, 2016)

You may find something at http://www.leidinger.net/FreeBSD/dox/cam/html/index.html


----------



## Terry_Kennedy (May 12, 2016)

Neeraj Singh said:


> Can anybody help on this??


You probably want /usr/include/cam/scsi/scsi_sg.h. However, even the brief log excerpt you posted shows you are using functions not present in FreeBSD - those functions are there in support of some Linux utilities that make light use of sg functionality. The equivalent native FreeBSD functionality is provided via the pass(4) driver. While the API is somewhat different, an experienced Linux programmer who had almost no FreeBSD experience was able to convert a large application's code to pass(4) in a brief period of time with just a few hints from me.


----------

