473,405 Members | 2,262 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Syscall problem ?

Hi :

I code a program by c called "inter". I have another program called
"end"

Can I code in "end " to use the syscall ( "inter") ?

If Yes , which kind of command format should I write?

thanks for any comments.

bin

Nov 15 '05 #1
6 1869
In article <11**********************@g43g2000cwa.googlegroups .com>,
yezi <ye*****@hotmail.com> wrote:
I code a program by c called "inter". I have another program called
"end" Can I code in "end " to use the syscall ( "inter") ? If Yes , which kind of command format should I write?


I suggest you examine the documentation for the system() routine.
Pretty much all the standard says is that this will invoke
system-defined behaviour. -Usually- the string you pass into
system() is a command line that will be parsed by -something-
and the appropriate program started up.

Note: if "inter" really is a "syscall" (system call) then the
mechanisms you will need to invoke it would be operating system
dependant. Most operating systems make it difficult to add
your own system calls.
--
I am spammed, therefore I am.
Nov 15 '05 #2
I have another problem with that. Suppose I systemcall the function is
success, is that mean "inter" and the "end " is running simultaneously
or like the following way :

"end" ->"inter" then "end".

Thanks

Nov 15 '05 #3
In article <11*********************@g43g2000cwa.googlegroups. com>,
yezi <ye*****@hotmail.com> wrote:
I have another problem with that. Suppose I systemcall the function is
success, is that mean "inter" and the "end " is running simultaneously
or like the following way : "end" ->"inter" then "end".


Here is the entire C89 documentation about system()

=== begin documentation ===
4.10.4.5 The system Function

Synopsis:
#include <stdlib.h>
int system(const char *string);

Description:

The system function passes the string pointed to by string to
the host environment to be executed by a command processor in an
implementation-defined manner. A null pointer may be used for
string to inquire whether a command processor exists.

Returns:

If the argument is a null pointer, the system function returns nonzero
only if a command processor is available. If the argument is not
a null pointer, the system function returns an implementation-defined
value.
=== end documentation ===

Looking at this, you can see that what happens is operating-system
specific, not defined by C. In order to know what happens on *your*
operating system, you should consult the documentation for your
operating system, or ask in a newsgroup specific to that operating
system.
The most -common- behaviour is that system() does not return
until the invoked command terminates, but that is not the only
behaviour possible and on many systems the behaviour can be modified
in an operating-system specific manner.

If you are trying to get the called program to execute at the same time
as the calling program, the mechanisms for doing that are operating
system specific, and you should consult elsewhere. In particular,
the mechanisms for Windows are considerably different than those
for Unix-like systems.
--
If you lie to the compiler, it will get its revenge. -- Eric Sosman
Nov 15 '05 #4
On 2005-10-31, Walter Roberson <ro******@ibd.nrc-cnrc.gc.ca> wrote:
In article <11*********************@g43g2000cwa.googlegroups. com>,
yezi <ye*****@hotmail.com> wrote:
I have another problem with that. Suppose I systemcall the function is
success, is that mean "inter" and the "end " is running simultaneously
or like the following way :

"end" ->"inter" then "end".


Here is the entire C89 documentation about system()

=== begin documentation ===
4.10.4.5 The system Function

Synopsis:
#include <stdlib.h>
int system(const char *string);

Description:

The system function passes the string pointed to by string to
the host environment to be executed by a command processor in an
implementation-defined manner. A null pointer may be used for
string to inquire whether a command processor exists.

Returns:

If the argument is a null pointer, the system function returns nonzero
only if a command processor is available. If the argument is not
a null pointer, the system function returns an implementation-defined
value.
=== end documentation ===


C99 adds:
| If string is not a null pointer, the system function passes the
| string pointed to by string to that command processor to be
| executed in a manner which the implementation shall document; this
| might then cause the program calling system to behave in a
| non-conforming manner or to terminate

This tells me that reasonable things for an implementation to do
are:

Block until the command finishes.

Return immediately, and then the command and your program run
concurrently.

Replace your program with the requested command.
hmm - this is really another subject, but on the same page as that:

The implementation shall behave as if no library function calls the
getenv function.

that strikes me as odd. many implementations have lots of library
functions that use environment variables, particularly for
locale-dependent stuff, or for determining the local timezone. Or
are they allowed to look in the environment as long as they don't do
it by calling getenv?
Nov 15 '05 #5
On Tue, 01 Nov 2005 03:05:16 +0000, Jordan Abel wrote:
[...]
hmm - this is really another subject, but on the same page as that:

The implementation shall behave as if no library function calls the
getenv function.

that strikes me as odd. many implementations have lots of library
functions that use environment variables, particularly for
locale-dependent stuff, or for determining the local timezone. Or
are they allowed to look in the environment as long as they don't do
it by calling getenv?


They're even allowed to do it by calling getenv, so long as they behave as
though they're not.

--
http://members.dodo.com.au/~netocrat
Nov 15 '05 #6
In article <sl*******************@random.yi.org>,
Jordan Abel <jm****@purdue.edu> wrote:
On 2005-10-31, Walter Roberson <ro******@ibd.nrc-cnrc.gc.ca> wrote:
Here is the entire C89 documentation about system()

C99 adds:
| If string is not a null pointer, the system function passes the
| string pointed to by string to that command processor to be
| executed in a manner which the implementation shall document; this
| might then cause the program calling system to behave in a
| non-conforming manner or to terminate This tells me that reasonable things for an implementation to do
are: Block until the command finishes. Return immediately, and then the command and your program run
concurrently. Replace your program with the requested command.


You missed some cases, such as system() of something that
sends a fatal signal to your program; or system() of something that
messes with your own process memory; or system() of something that
messes with kernel memory; or system() of something that crashes
taking down the system with it.
--
Programming is what happens while you're busy making other plans.
Nov 15 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Oli Schwarz | last post by:
Hello, how can I read out the uptime of a unix system in python (Linux and *BSD). I have not found a uptime-function in the Library. Regards Oli
1
by: Thomas Keller | last post by:
Hello there! I have a small problem while setting up a chrooted cvs server which returns "No such system user" when I try to do some action on it (e.g. "cvs co module"). I tracked the problem...
10
by: Vineet | last post by:
If anybody has any insight into this problem I'm running into I would really appreciate if you could write to me... I'm running a simple C++ program on Solaris 8 that forks and execs a bunch of...
2
by: alok | last post by:
Hi I have opened a serial port and then blocked on a select system call . but select returns even if no data is comming from other end. So when I read the buffer after select returns, I only...
0
by: Kurt B. Kaiser | last post by:
Patch / Bug Summary ___________________ Patches : 385 open (+21) / 3790 closed (+21) / 4175 total (+42) Bugs : 1029 open (+43) / 6744 closed (+43) / 7773 total (+86) RFE : 262 open...
2
by: mfleet1973 | last post by:
Hi. I'm quite new to C++. Please provide the code that does the following: Allocates 500 bytes of memory Allocates 10 kb of memory Allocates 1 mb of memory
3
by: Peter Wang | last post by:
Hi, all. I recently encountered a very annoying problem while using Zend Framework(ZF). We use ZF in our web application, and it works fine at the beginning, but later when concurrent...
10
by: sitko | last post by:
Hi, I'm getting a weird error with my C program. It receives parameters from a text file that is created by a VB wrapper program. One of the inputs is a "jobname". The code bombs when certain...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.