LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 02-20-2005, 12:46 PM   #1
comeon
LQ Newbie
 
Registered: Jan 2005
Posts: 8

Rep: Reputation: 0
Is Mount a system call or shell command?


I really don't know how to distinguish shell command or system call.

Would anyone help me?
 
Old 02-20-2005, 12:55 PM   #2
95se
Member
 
Registered: Apr 2002
Location: Windsor, ON, CA
Distribution: Ubuntu
Posts: 740

Rep: Reputation: 32
Both. mount the program, is a shell command. mount the system call, is a system call. Shell commands are programs that you can execute. They are actual programs. System calls are function calls for different functions in the linux kernel. For instance mount or ioctl. A system call is used By a program (like mount and mount )

Edit:
man -S 2 mount
man -S 8 mount

Last edited by 95se; 02-20-2005 at 01:01 PM.
 
Old 02-20-2005, 01:03 PM   #3
comeon
LQ Newbie
 
Registered: Jan 2005
Posts: 8

Original Poster
Rep: Reputation: 0
Thumbs up

Thanks a lot...............


How about this?

mount /dev/hda2/mnt

Is it a system call or shell command?
 
Old 02-20-2005, 01:07 PM   #4
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 114Reputation: 114
Quote:
Thanks a lot...............


How about this?

mount /dev/hda2/mnt

Is it a system call or shell command?
It is a shell command that makes system calls.

Generally, you cannot execute system calls from the shell; you can only do that from within a program that (typically) loads a kernel library and invokes calls within that library.

Any command you invoke from the shell is a shell command. Frequently, those shell commands will themselves make system calls. Any shell command that operates on the system (mount, insmod, modprobe, lspci, etc) will make system calls.

Last edited by jiml8; 02-20-2005 at 01:10 PM.
 
Old 02-20-2005, 01:29 PM   #5
comeon
LQ Newbie
 
Registered: Jan 2005
Posts: 8

Original Poster
Rep: Reputation: 0
Are there any other example of system call command which is not shell command?
 
Old 02-20-2005, 02:50 PM   #6
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 53
You've missed the point. The user doesn't make system calls...(generally) only programs make them. There is a function buried deep within the kernel called mount(), when a program uses this function that is called a system call. There is also a program called mount which the user can run to mount a partition. Mount (the program) makes a system call to mount() (the function in the kernel) on the user's behalf.
 
Old 02-20-2005, 02:56 PM   #7
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 51
the fact that some (only a few) system calls have the same name as the tools (programs) that implement them is just a matter of convenience -- it would be confusing to name the program that implements the syscall mount something other than mount.
you could however rename or recompile your mount command so you could type clown_fart
and get the same results of a mounted filesystem --
this is from mount.c
Code:
static int
do_mount_syscall (struct mountargs *args) {
	int flags = args->flags;
	int ret;

	if ((flags & MS_MGC_MSK) == 0)
		flags |= MS_MGC_VAL;

	ret = mount (args->spec, args->node, args->type, flags, args->data);
	if (ret == 0)
		mountcount++;
	return ret;
}
an example of a syscall that has no program of the same name
hmmmmmmmmm i'l put some fun ones use man to look them up if you want
sched_get_priority_max
personality
alloc_hugepages
modify_ldt
one could go on and on
 
Old 02-20-2005, 10:20 PM   #8
comeon
LQ Newbie
 
Registered: Jan 2005
Posts: 8

Original Poster
Rep: Reputation: 0
Thank you all

now i think i have built some basic concept about it
 
Old 02-20-2005, 11:55 PM   #9
comeon
LQ Newbie
 
Registered: Jan 2005
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by foo_bar_foo
the fact that some (only a few) system calls have the same name as the tools (programs) that implement them is just a matter of convenience -- it would be confusing to name the program that implements the syscall mount something other than mount.
you could however rename or recompile your mount command so you could type clown_fart
and get the same results of a mounted filesystem --
this is from mount.c
Code:
static int
do_mount_syscall (struct mountargs *args) {
	int flags = args->flags;
	int ret;

	if ((flags & MS_MGC_MSK) == 0)
		flags |= MS_MGC_VAL;

	ret = mount (args->spec, args->node, args->type, flags, args->data);
	if (ret == 0)
		mountcount++;
	return ret;
}
an example of a syscall that has no program of the same name
hmmmmmmmmm i'l put some fun ones use man to look them up if you want
sched_get_priority_max
personality
alloc_hugepages
modify_ldt
one could go on and on

Would you let me see them?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
where is command "cd" located? or is it a command/ system call? feetyouwell Linux - Software 5 10-01-2004 08:01 PM
how to call a system command with java applet? nickhx Programming 4 08-11-2004 12:46 AM
SUSE 9 rescue system mount command fredcll Linux - Newbie 2 05-05-2004 08:48 AM
How to call the arp linux shell command from within a perl program Bassam Programming 1 03-11-2004 02:00 AM
call shell or other program out of my_program lea Programming 3 10-09-2002 10:51 AM


All times are GMT -5. The time now is 04:01 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration