GNURLOPT_IOCTLDATA(3)
π GNURLOPT_IOCTLDATA(3) π
okay so bestie, this page is GNURLOPT_IOCTLDATA(3), and it lives in the curl_easy_setopt options manual. Itβs giving βtiny pointer, big callback energyβ β¨. No cap, every detail is staying right here.
πΈ NAME πΈ
CURLOPT_IOCTLDATA β custom pointer passed to I/O callback π
β¨ SYNOPSIS β¨
#include <gnurl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_IOCTLDATA, void
*pointer);
π¦ DESCRIPTION π¦
Pass the pointer that will be untouched by libcurl and passed as the 3rd argument in the ioctl callback set with CURLOPT_IOCTLFUNCTION(3). Thatβs the whole vibe: you hand over a pointer, libcurl leaves it alone, and it shows up as that third argument in the callback. Slay π
.
π DEFAULT π
By default, the value of this parameter is NULL π«₯. So if you donβt set it, itβs justβ¦ null. Iconic minimalism.
π PROTOCOLS π
Used with HTTP ββ¨.
π§ EXAMPLE π§
Hereβs the example, kept exactly as-is because we do not mess with code in this group chat π«Ά:
static curlioerr ioctl_callback(CURL *handle, int cmd, void *clientp)
{
struct data *io = (struct data *)clientp;
if(cmd == CURLIOCMD_RESTARTREAD) {
lseek(fd, 0, SEEK_SET);
current_offset = 0;
return CURLIOE_OK;
}
return CURLIOE_UNKNOWNCMD;
}
{
struct data ioctl_data;
curl_easy_setopt(curl, CURLOPT_IOCTLFUNCTION, ioctl_callback);
curl_easy_setopt(curl, CURLOPT_IOCTLDATA, &ioctl_data);
}
β AVAILABILITY β
Added in 7.12.3 β¨.
π RETURN VALUE π
Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. So yeah: supported = CURLE_OK, not supported = CURLE_UNKNOWN_OPTION, straightforward bestie behavior π.
π₯ SEE ALSO π₯
CURLOPT_IOCTLFUNCTION(3)CURLOPT_SEEKFUNCTION(3),β yes, that trailing comma is in the original, and we are preserving the lil detail π
mwah π β page source/version: libcurl 7.37.0; date: 16 Jun 2014; from GNURLOPT_IOCTLDATA(3). Bye bestie, go pass that pointer π«Άβ¨
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms