LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 12-06-2007, 11:50 PM   #1
devkpict
Member
 
Registered: Oct 2007
Posts: 31

Rep: Reputation: 15
Thumbs up How to pass IOCTL arguments from usespace ioctl call


Hi All,

I am calling ext3_ioctl, using ioctl() call in userspace,

I need guidence for passing arguments with ioctl() from

userspace.
 
Old 12-07-2007, 06:45 PM   #2
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Have you looked at man 2 ioctl? What exactly do you want to do? Something like the following?
Code:
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>

#include <sys/ioctl.h>
#include <linux/fs.h>
#include <linux/ext3_fs.h>

int main(int argc, char *argv[])
{
	int fd, flags = EXT3_SYNC_FL;
	if(argc != 2) {
		fprintf(stderr, "Usage: %s filename\n", argv[0]);
		exit(EXIT_FAILURE);
	}
	if((fd = open(argv[1], O_RDWR)) == -1) {
		perror("open");
		exit(EXIT_FAILURE);
	}
	if(ioctl(fd, EXT3_IOC_SETFLAGS, &flags) == -1) {
		perror("ioctl");
		close(fd);
		exit(EXIT_FAILURE);
	}
	exit(EXIT_SUCCESS);
}
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Wvdial failing on ioctl call as regular user mugwump84 Linux - Software 3 11-27-2005 01:01 PM
dm driver ioctl call tantrix Programming 0 05-16-2005 06:50 PM
ioctl.h blackzone Programming 1 07-26-2004 03:30 AM
Ioctl() call fails Custer Linux - Wireless Networking 0 02-16-2004 12:47 PM
ioctl unosoft Linux - Software 0 09-12-2003 06:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 05:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration