Sponsored Content
Top Forums Programming How to kill disowned process which calls getchar() in code Post 302537874 by 17amrut29 on Monday 11th of July 2011 12:39:21 AM
Old 07-11-2011
How to kill disowned process which calls getchar() in code

Hi,

What happens to process state when getchar() is called? I wrote a C code in which I call getchar() somewhere down the road. I forgot about that, I started the process, put it in bg and disowned it using "disown". Now, how do I see where that process has gone/how do kill it?

Thanks,
Amrut
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Process calls - making sense of truss results

Can someone point me at resources for system calls? Specifically, I am trying to make sense of what I am seeing in a truss command. Thanks! (3 Replies)
Discussion started by: jpeery
3 Replies

2. UNIX for Advanced & Expert Users

When kill doesnt work, how to kill a process ?

Hi All, I am unable to kill a process using kill command. I am using HP-UX system. I have tried with kill -9 and i have root privilages. How can i terminate this daemon ? ? ? Regards, Vijay Hegde (3 Replies)
Discussion started by: VijayHegde
3 Replies

3. Shell Programming and Scripting

how to start a process and make it sleep for 5 mins and then kill that process

how to start a process and make it sleep for 5 mins and then kill that process (6 Replies)
Discussion started by: shrao
6 Replies

4. Programming

kill(0,-9) don't kill the process

Hi all i have simple c program , when i wish to kill the app im using kill(0,-9) , but it seams this command don't do any thing and the program. just ignore it . what im doing wrong here ? im using HP-UX ia64 Thanks (9 Replies)
Discussion started by: umen
9 Replies

5. Shell Programming and Scripting

Kill a process without using kill command

Sorry, posted the question in other forum. (0 Replies)
Discussion started by: sudhamacs
0 Replies

6. Linux

Kill a process without using kill command

I want to Kill a process without using kill command as i don't have privileges to kill the process. I know the pid and i am using Linux 2.6.9 OS. (6 Replies)
Discussion started by: sudhamacs
6 Replies

7. Shell Programming and Scripting

Shell Script to Kill Process(number of process) Unix/Solaris

Hi Experts, we do have a shell script for Unix Solaris, which will kill all the process manullay, it used to work in my previous env, but now it is throwing this error.. could some one please help me to resolve it This is how we execute the script (and this is the requirement) ... (2 Replies)
Discussion started by: jonnyvic
2 Replies

8. Shell Programming and Scripting

grep the process id and kill all the filtered process

Hi I want to write a shell script which can find the process id's of all the process and kill them eg: ps ax | grep rv_ 3015 ? S 0:00 /home/vivek/Desktop/rv_server 3020 ? S 0:00 /home/vivek/Desktop/rv_gps 3022 ? S 0:00 /home/vivek/Desktop/rv_show ... (7 Replies)
Discussion started by: vivek_naragund
7 Replies

9. UNIX for Dummies Questions & Answers

Script to start background process and then kill process

What I need to learn is how to use a script that launches background processes, and then kills those processes as needed. The script successfully launches the script. But how do I check to see if the job exists before I kill it? I know my problem is mostly failure to understand parameter... (4 Replies)
Discussion started by: holocene
4 Replies

10. Shell Programming and Scripting

Kill an specific process ID using the KILL and GREP commands

Good afternoon I need to KILL a process in a single command sentence, for example: kill -9 `ps -aef | grep 'CAL255.4ge' | grep -v grep | awk '{print $2}'` That sentence Kills the process ID corresponding to the program CAL255.4ge. However it is possible that the same program... (6 Replies)
Discussion started by: enriquegm82
6 Replies
getc(3) 						     Library Functions Manual							   getc(3)

NAME
getc, fgetc, getc_unlocked, getchar, getchar_unlocked, getw - Get a byte or word from an input stream LIBRARY
Standard C Library (libc) SYNOPSIS
#include <stdio.h> int getc( FILE *stream); int fgetc( FILE *stream); int getc_unlocked( FILE * stream); int getchar(void); int getchar_unlocked(void); int getw( FILE *stream); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: fgetc(), getc_unlocked, getc(), getchar(), getchar_unlocked, getw(): XSH5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Points to the file structure of an open file. DESCRIPTION
The getc() function returns the next byte from the input specified by the stream parameter and moves the file pointer, if defined, ahead one byte in stream. The getc() function may be a macro (depending on compile-time definitions). See the NOTES section for more information. The fgetc() function performs the same function as getc(). The getchar() function returns the next byte from stdin, the standard input stream. Note that getchar() can also be a macro. [Tru64 UNIX] The reentrant versions of these functions are all locked against multiple threads calling them simultaneously. This will incur an overhead to ensure integrity of the stream. The unlocked versions of these calls, getc_unlocked() and getchar_unlocked() may be used to avoid the overhead. The getc_unlocked() and getchar_unlocked() functions are functionally identical to the getc() and getchar() functions, except that getc_unlocked() and getchar_unlocked() may be safely used only within a scope that is protected by the flockfile() and funlockfile() functions used as a pair. The caller must ensure that the stream is locked before these functions are used. The getc() and getchar() functions can also be macros. The getw() function reads the next word (int) from the stream. The size of a word is the size of an int, which may vary from one machine architecture to another. The getw() function returns the constant EOF at the end of the file or when an error occurs. Since EOF is a valid integer value, the feof() and ferror() functions can be used to check the success of getw(). The getw() function assumes no special align- ment in the file. Because of possible differences in int length and byte ordering from one machine architecture to another, files written using the putw() subroutine are machine dependent and may not be readable using getw() on a different type of processor. NOTES
The getc() and getchar() functions may be macros (depending on the compile-time definitions used in the source). Consequently, you cannot use these interfaces where a function is necessary; for example, a subroutine pointer cannot point to one of these interfaces. In addi- tion, getc() does not work correctly with a stream parameter that has side effects. In particular, the following does not work: getc(*f++) In cases like this one, use the fgetc() function instead. RETURN VALUES
Upon successful completion, these functions and macros return the next byte or word from the input stream. If the stream is at end-of- file, the end-of-file indicator for the stream is set and the integer constant EOF is returned. If a read error occurs, the error indica- tor for the stream is set, EOF is returned, and errno is set to indicate the error. ERRORS
The fgetc(), getc(), getc_unlocked(), getchar(), getchar_unlocked(), and getw() functions set errno to the specified value for the follow- ing conditions: The O_NONBLOCK flag is set for the underlying stream and the process would be delayed by the read operation. The file descriptor underlying the stream is not a valid file descriptor or is not open for reading. The read operation was interrupted by a signal which was caught and no data was transferred. The call is attempting to read from the process's controlling terminal and either the process is ignoring or blocking the SIGTTIN signal or the process group is orphaned. A physical I/O error has occurred. (This condition was defined for Issue 4 Version 2 and higher issues of the XSH specification.) Insufficient memory is available for the operation. The device associated with stream does not exist. RELATED INFORMATION
Functions: flockfile(3), funlockfile(3), gets(3), getwc(3), putc(3) Standards: standards(5) delim off getc(3)
All times are GMT -4. The time now is 10:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy