LLAPI_IOCTL(3)
π LLAPI_IOCTL β bestie edition π
okay so this is a page from the Lustre Library Functions corner of the manual, section 3 (the library-functions section, iykyk). Sit down, grab a boba, we're learning llapi_ioctl π«Ά
β¨ NAME β¨
llapi_ioctl β call ioctl() but with possible command remapping π
β¨ SYNOPSIS β¨
#include <lustre/lustreapi.h>
int llapi_ioctl(int fd, unsigned int cmd, void *buf);
β¨ DESCRIPTION β¨
So here's the tea β β llapi_ioctl() calls the ioctl(2) system call with the arguments you hand it. Simple, right? But there's a lil plot twist π
If ioctl() comes back with ENOTTY (that's the "no such ioctl" vibe), then if cmd has been remapped from an older ioctl command number, the ioctl() call gets retried using that old ioctl command number. So it's like, "sorry bestie, try the legacy one" and it does πβ¨
β¨ RETURN VALUES β¨
llapi_ioctl() typically returns:
0β on success, in most cases π<0β a negative value on failure, and it setserrno. And ngl, because ioctl commands are so varied, it may return different values anderrnoas appropriate for thefd, thecmdnumber, and thebufargument you passed in. No single fixed answer, it's giving "depends" π
β¨ EXAMPLES β¨
here's the whole thing, verbatim, no edits, main character energy:
#include <lustre/lustreapi.h>
int main(int argc, char *argv[])
{
unsigned long group = 1234;
int rc, fd;
fd = open(argv[1], O_RDONLY);
if (rc < 0) {
fprintf(stderr, "error opening file '%s': %s\n",
argv[1], strerror(errno));
return -1;
}
rc = llapi_ioctl(fd, LL_IOC_GROUP_LOCK, &group);
if (rc < 0) {
fprintf(stderr, "%s: ioctl error: %s\n",
argv[1], strerror(errno));
return rc;
}
printf("%s: locked with group %lu\n", argv[1], group);
return 0;
}
β¨ AVAILABILITY β¨
llapi_ioctl() has been part of the lustre(7) user application interface library since release 2.16.0 π so if you're on anything older, sorry babe, you don't got it yet π
β¨ SEE ALSO β¨
reminder bestie: keep everycmd,fd,bufanderrnoexactly as-is when you write your own code. The remapping is real, the vibes are immaculate, but the flags are the flags π
and that's the whole page, no crumbs left π this was Lustre User API, dated 2024-08-27, and yes she ate πβ¨ mwah, go forth and ioctl responsibly π
π¦ where this page comes from
- ubuntu stonking: lustre-client-utils 2.17.58+dfsg-0ubuntu2 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms