manpagez: man pages & more
info gdb
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]


int system(const char *command);


Return value:

If len is zero, the return value indicates whether a shell is available. A zero return value indicates a shell is not available. For non-zero len, the value returned is -1 on error and the return status of the command otherwise. Only the exit status of the command is returned, which is extracted from the host's system return value by calling WEXITSTATUS(retval). In case ‘/bin/sh’ could not be executed, 127 is returned.


The call was interrupted by the user.

No value for GDBN takes over the full task of calling the necessary host calls to perform the system call. The return value of system on the host is simplified before it's returned to the target. Any termination signal information from the child process is discarded, and the return value consists entirely of the exit status of the called command.

Due to security concerns, the system call is by default refused by No value for GDBN. The user has to allow this call explicitly with the set remote system-call-allowed 1 command.

set remote system-call-allowed

Control whether to allow the system calls in the File I/O protocol for the remote target. The default is zero (disabled).

show remote system-call-allowed

Show whether the system calls are allowed in the File I/O protocol.

© 2000-2017
Individual documents may contain additional copyright information.