Skip Navigation Links | |
Exit Print View | |
man pages section 3: Extended Library Functions, Volume 1 Oracle Solaris 11.1 Information Library |
Extended Library Functions, Volume 1
CIRCLEQ_HEAD_INITIALIZER(3EXT)
cpc_walk_generic_events_all(3CPC)
cpc_walk_generic_events_pic(3CPC)
ct_dev_status_get_aset(3CONTRACT)
ct_dev_status_get_dev_state(3CONTRACT)
ct_dev_status_get_minor(3CONTRACT)
ct_dev_status_get_noneg(3CONTRACT)
ct_dev_tmpl_clear_noneg(3CONTRACT)
ct_dev_tmpl_get_aset(3CONTRACT)
ct_dev_tmpl_get_minor(3CONTRACT)
ct_dev_tmpl_get_noneg(3CONTRACT)
ct_dev_tmpl_set_aset(3CONTRACT)
ct_dev_tmpl_set_minor(3CONTRACT)
ct_dev_tmpl_set_noneg(3CONTRACT)
ct_event_read_critical(3CONTRACT)
ct_pr_event_get_exitstatus(3CONTRACT)
ct_pr_event_get_gcorefile(3CONTRACT)
ct_pr_event_get_pcorefile(3CONTRACT)
ct_pr_event_get_pid(3CONTRACT)
ct_pr_event_get_ppid(3CONTRACT)
ct_pr_event_get_sender(3CONTRACT)
ct_pr_event_get_senderct(3CONTRACT)
ct_pr_event_get_signal(3CONTRACT)
ct_pr_event_get_zcorefile(3CONTRACT)
ct_pr_status_get_contracts(3CONTRACT)
ct_pr_status_get_fatal(3CONTRACT)
ct_pr_status_get_members(3CONTRACT)
ct_pr_status_get_param(3CONTRACT)
ct_pr_status_get_svc_aux(3CONTRACT)
ct_pr_status_get_svc_creator(3CONTRACT)
ct_pr_status_get_svc_ctid(3CONTRACT)
ct_pr_status_get_svc_fmri(3CONTRACT)
ct_pr_tmpl_get_fatal(3CONTRACT)
ct_pr_tmpl_get_param(3CONTRACT)
ct_pr_tmpl_get_svc_aux(3CONTRACT)
ct_pr_tmpl_get_svc_fmri(3CONTRACT)
ct_pr_tmpl_get_transfer(3CONTRACT)
ct_pr_tmpl_set_fatal(3CONTRACT)
ct_pr_tmpl_set_param(3CONTRACT)
ct_pr_tmpl_set_svc_aux(3CONTRACT)
ct_pr_tmpl_set_svc_fmri(3CONTRACT)
ct_pr_tmpl_set_transfer(3CONTRACT)
ct_status_get_cookie(3CONTRACT)
ct_status_get_critical(3CONTRACT)
ct_status_get_holder(3CONTRACT)
ct_status_get_informative(3CONTRACT)
ct_status_get_nevents(3CONTRACT)
ct_status_get_nevid(3CONTRACT)
ct_status_get_ntime(3CONTRACT)
ct_status_get_qtime(3CONTRACT)
ct_status_get_state(3CONTRACT)
ct_status_get_zoneid(3CONTRACT)
ct_tmpl_get_critical(3CONTRACT)
ct_tmpl_get_informative(3CONTRACT)
ct_tmpl_set_critical(3CONTRACT)
ct_tmpl_set_informative(3CONTRACT)
dat_evd_clear_unwaitable(3DAT)
dat_get_consumer_context(3DAT)
dat_registry_add_provider(3DAT)
dat_registry_list_providers(3DAT)
dat_registry_remove_provider(3DAT)
dat_set_consumer_context(3DAT)
devid_deviceid_to_nmlist(3DEVID)
di_link_next_by_lnode(3DEVINFO)
di_link_next_by_node(3DEVINFO)
di_lnode_private_get(3DEVINFO)
di_lnode_private_set(3DEVINFO)
di_minor_private_get(3DEVINFO)
di_minor_private_set(3DEVINFO)
di_path_client_devfs_path(3DEVINFO)
di_path_client_next_path(3DEVINFO)
di_path_phci_next_path(3DEVINFO)
di_path_prop_lookup_bytes(3DEVINFO)
di_path_prop_lookup_int64s(3DEVINFO)
di_path_prop_lookup_ints(3DEVINFO)
di_path_prop_lookup_strings(3DEVINFO)
di_path_prop_strings(3DEVINFO)
di_prom_prop_lookup_bytes(3DEVINFO)
di_prom_prop_lookup_ints(3DEVINFO)
di_prom_prop_lookup_strings(3DEVINFO)
di_prop_lookup_bytes(3DEVINFO)
di_prop_lookup_int64(3DEVINFO)
di_prop_lookup_strings(3DEVINFO)
ea_match_object_catalog(3EXACCT)
- send a file
cc [ flag… ] file… -lsendfile [ library... ] #include <sys/sendfile.h> ssize_t sendfilev(int fildes, const struct sendfilevec *vec, int sfvcnt, size_t *xferred);
The sendfilev() function supports the following parameters:
A file descriptor to a regular file or to a AF_NCA, AF_INET, or AF_INET6 family type SOCK_STREAM socket that is open for writing. For AF_NCA, the protocol type should be zero.
An array of SENDFILEVEC_T, as defined in the sendfilevec structure above.
The number of members in vec.
The total number of bytes written to out_fd.
The sendfilev() function attempts to write data from the sfvcnt buffers specified by the members of vec array: vec[0], vec[1], ... , vec[sfvcnt–1]. The fildes argument is a file descriptor to a regular file or to an AF_NCA, AF_INET, or AF_INET6 family type SOCK_STREAM socket that is open for writing.
This function is analogous to writev(2), but can read from both buffers and file descriptors. Unlike writev(), in the case of multiple writers to a file the effect of sendfilev() is not necessarily atomic; the writes may be interleaved. Application-specific synchronization methods must be employed if this causes problems.
The following is the sendfilevec structure:
typedef struct sendfilevec { int sfv_fd; /* input fd */ uint_t sfv_flag; /* Flags. see below */ off_t sfv_off; /* offset to start reading from */ size_t sfv_len; /* amount of data */ } sendfilevec_t; #define SFV_FD_SELF (-2)
To send a file, open the file for reading and point sfv_fd to the file descriptor returned as a result. See open(2). sfv_off should contain the offset within the file. sfv_len should have the length of the file to be transferred.
The xferred argument is updated to record the total number of bytes written to out_fd.
The sfv_flag field is reserved and should be set to zero.
To send data directly from the address space of the process, set sfv_fd to SFV_FD_SELF. sfv_off should point to the data, with sfv_len containing the length of the buffer.
Upon successful completion, the sendfilev() function returns total number of bytes written to out_fd. Otherwise, it returns -1, and errno is set to indicate the error. The xferred argument contains the amount of data successfuly transferred, which can be used to discover the error vector.
The process does not have appropriate privileges or one of the files pointed by sfv_fd does not have appropriate permissions.
The implementation does not support the specified address family for socket.
Mandatory file or record locking is set on either the file descriptor or output file descriptor if it points at regular files. O_NDELAY or O_NONBLOCK is set, and there is a blocking record lock. An attempt has been made to write to a stream that cannot accept data with the O_NDELAY or the O_NONBLOCK flag set.
The fildes argument is not a valid descriptor open for writing or an sfv_fd is invalid or not open for reading.
The vec argument points to an illegal address.
The xferred argument points to an illegal address.
A signal was caught during the write operation and no data was transferred.
The sfvcnt argument was less than or equal to 0. One of the sfv_len values in vec array was less than or equal to 0, or greater than the file size. An sfv_fd is not seekable.
Fewer bytes were transferred than were requested.
An I/O error occurred while accessing the file system.
There is insufficient memory available. The offset parameter is updated by the amount of data transferred so that the call may be retried.
The fildes argument is a socket that has been shut down for writing.
The socket type is not supported.
The sendfilev() function has a transitional interface for 64-bit file offsets. See lf64(5).
The following example sends 2 vectors, one of HEADER data and a file of length 100 over sockfd. sockfd is in a connected state, that is, socket(), accept(), and bind() operation are complete.
#include <sys/sendfile.h> . . . int main (int argc, char *argv[]){ int sockfd; ssize_t ret; size_t xfer; struct sendfilevec vec[2]; . . . vec[0].sfv_fd = SFV_FD_SELF; vec[0].sfv_flag = 0; vec[0].sfv_off = "HEADER_DATA"; vec[0].sfv_len = strlen("HEADER_DATA"); vec[1].sfv_fd = open("input_file",.... ); vec[1].sfv_flag = 0; vec[1].sfv_off = 0; vec[1].sfv_len = 100; ret = sendfilev(sockfd, vec, 2, &xfer); . . . }
See attributes(5) for descriptions of the following attributes:
|
open(2), writev(2), libsendfile(3LIB), sendfile(3EXT), socket(3SOCKET), attributes(5)