CURLOPT_IOCTLDATA(3)
β¨ NAME β¨
CURLOPT_IOCTLDATA - pointer passed to I/O callback π
πΈ SYNOPSIS πΈ
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_IOCTLDATA, void *pointer);
π¦ DESCRIPTION π¦
Okay so bestie, you pass in a pointer here, and libcurl literally does not touch it β it stays untouched by libcurl β and then it gets passed as the 3rd argument in the ioctl callback that you set with CURLOPT_IOCTLFUNCTION(3) β¨
π DEFAULT π
NULL β that's the default, no pointer, periodt π
π PROTOCOLS π
This functionality affects all supported protocols β yes, all of them, no cap β¨
π§ EXAMPLE π§
Here's the whole vibe, bestie:
#include <unistd.h> /* for lseek */
struct data {
int fd; /* our file descriptor */
};
static curlioerr ioctl_callback(CURL *handle, int cmd, void *clientp)
{
struct data *io = (struct data *)clientp;
if(cmd == CURLIOCMD_RESTARTREAD) {
lseek(io->fd, 0, SEEK_SET);
return CURLIOE_OK;
}
return CURLIOE_UNKNOWNCMD;
}
int main(void)
{
struct data ioctl_data;
CURL *curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_IOCTLFUNCTION, ioctl_callback);
curl_easy_setopt(curl, CURLOPT_IOCTLDATA, &ioctl_data);
}
}
π DEPRECATED π
Deprecated since 7.18.0. So yeah, this one is deprecated, bestie β noted and flagged π
β AVAILABILITY β
Added in curl 7.12.3 π
π RETURN VALUE π
curl_easy_setopt(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see libcurl-errors(3).
π«Ά SEE ALSO π«Ά
Signed, sealed, and delivered by libcurl π dated 2026-10-12, all about CURLOPT_IOCTLDATA(3) β bye bestie! π
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms