Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| net_ioctl [2018/09/03 15:58] – [Kernel workflow] rpjday | net_ioctl [2018/09/04 10:31] (current) – [send_ioctl()] rpjday | ||
|---|---|---|---|
| Line 18: | Line 18: | ||
| * [[https:// | * [[https:// | ||
| - | ===== Sample userspace call ===== | + | ===== Sample userspace call: ethtool |
| - | From '' | + | Git repo is [[https:// |
| + | |||
| + | ==== send_ioctl() ==== | ||
| + | |||
| + | From '' | ||
| < | < | ||
| Line 26: | Line 30: | ||
| int send_ioctl(struct cmd_context *ctx, void *cmd) | int send_ioctl(struct cmd_context *ctx, void *cmd) | ||
| { | { | ||
| - | ctx-> | + | ctx-> |
| return ioctl(ctx-> | return ioctl(ctx-> | ||
| } | } | ||
| Line 32: | Line 36: | ||
| </ | </ | ||
| - | ===== struct ifreq ===== | + | QUESTION: What is returned in ifreq%%-> |
| + | |||
| + | ==== struct cmd_context | ||
| + | |||
| + | From '' | ||
| + | |||
| + | < | ||
| + | /* Context for sub-commands */ | ||
| + | struct cmd_context { | ||
| + | const char *devname; | ||
| + | int fd; /* socket suitable for ethtool ioctl */ | ||
| + | struct ifreq ifr; /* ifreq suitable for ethtool ioctl */ | ||
| + | int argc; /* number of arguments to the sub-command */ | ||
| + | char **argp; | ||
| + | }; | ||
| + | |||
| + | </ | ||
| + | |||
| + | ==== struct ifreq ==== | ||
| - | From '' | + | From '' |
| < | < | ||
| Line 112: | Line 134: | ||
| ==== sock_ioctl() ==== | ==== sock_ioctl() ==== | ||
| - | Also from '' | + | Also from '' |
| < | < | ||
| Line 136: | Line 158: | ||
| return -EFAULT; | return -EFAULT; | ||
| } else | } else | ||
| + | </ | ||
| + | |||
| + | This reflects wireless extensions, which should not be relevant: | ||
| + | |||
| + | < | ||
| #ifdef CONFIG_WEXT_CORE | #ifdef CONFIG_WEXT_CORE | ||
| if (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) { | if (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) { | ||
| Line 141: | Line 168: | ||
| } else | } else | ||
| #endif | #endif | ||
| + | </ | ||
| + | |||
| + | Finally, this is where we should end up: | ||
| + | |||
| + | < | ||
| switch (cmd) { | switch (cmd) { | ||
| case FIOSETOWN: | case FIOSETOWN: | ||