Preloading open() for files sourced by tcsh


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Preloading open() for files sourced by tcsh
# 1  
Old 06-08-2018
Question Preloading open() for files sourced by tcsh

I am overriding the file open system calls (open, open64, fopen, fopen64, freopen, freopen64) in a dynamic library and setting LD_PRELOAD to point to that library. Here is a sample script I'm testing this on -
Code:
#!/bin/tcsh
source testcsh1.csh
source testbash1.sh

On RHEL 5.7 (tcsh 6.14.00), the open() called for testcsh1.csh and testbash1.sh is intercepted. However, the intercept (call to the overriding function in dynamic library) does not happen for the following -
  1. RHEL 6.6 (tcsh 6.17.00)
  2. RHEL 7.1 (tcsh 6.18.01)
  3. SLES 11 SP1 (tcsh 6.15.00)
  4. CentOS 6.6 (tcsh 6.17.00)
The open() which is not intercepted can be seen using gdb and strace.

Please advise on the possible reasons or the next steps to debug this. Thanks!

Last edited by endgame; 06-08-2018 at 07:14 AM..
# 2  
Old 06-08-2018
For what purpose are you overriding open()?
# 3  
Old 06-10-2018
Quote:
Originally Posted by Corona688
For what purpose are you overriding open()?
I need to collect which files are being opened from a complex scriptware. I don't see this problem for bash, ksh, perl and python scripts.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Return: can only `return' from a function or sourced script

Not sure where the problem is. I can run the script without any issue using the following command. . /opt/app/scripts/cdc_migration.sh But it fails with the below error when I try it this way /opt/app/scripts/cdc_migration.sh /opt/app/scripts/cdc_migration.sh: line 65: return: can only... (1 Reply)
Discussion started by: svajhala
1 Replies

2. Shell Programming and Scripting

open files

I want to open a file and edit it using vi However, i dont want to open directories or binary files. how can i do this? Right now it opens all files without caring echo "please enter a file to edit in Vi" read file if then (2 Replies)
Discussion started by: icelated
2 Replies

3. Shell Programming and Scripting

Error Installing Env::Sourced

Hello, I am trying to install Env::Sourced and i get the following error. sh: source: not found sh: include.sh: not found Unable to determine your shells source program, typically 'source' or '.' How can i overcome this? Best Regards, Christos (3 Replies)
Discussion started by: chriss_58
3 Replies

4. Shell Programming and Scripting

Quitting from a script, either sourced or not

This is a very simple problem, I am wondering why I can find no answer anywhere... I have a script that can be run either sourced or not. This script has some place where it needs to quit execution (e.g., when an error is found) If I "exit", the sourced call would exit the parent shell, but... (7 Replies)
Discussion started by: MadMage
7 Replies

5. Shell Programming and Scripting

how to rename all files that have a certain text in the filename using tcsh shell

Hello~ I'm on AIX version 5 and I believe I have the tcsh shell environment to play in. Can you guys help me with a solution to rename all files that have "eclp" in the filename to "ecl" ? I basically want to rename the files and strip the "p" out. i.e. original filenames: ... (3 Replies)
Discussion started by: in2vtec
3 Replies

6. Shell Programming and Scripting

KSH - Sourced file location

The sample scripts below, I am looking for the location of the sourced b.sh file. The b.sh file is source by multiple files, so it is not feasible to rely on a "global" variable or passed argument. Is there any way to determine the location of b.sh within b.sh? a.sh #!/bin/ksh echo "a:... (11 Replies)
Discussion started by: Al262
11 Replies

7. Shell Programming and Scripting

Exit from sourced script

Hello, I have written a script (say chld.sh). its structure is as follows: ------------------------ #!/bin/sh usage() { echo "chld.sh <param1> <param2>" exit 0 } chk_param_1() { case $param1 in c) export PATH=$PATH:/home_a/bin/execs;; d) export... (2 Replies)
Discussion started by: angad.makkar
2 Replies

8. UNIX for Advanced & Expert Users

Preloading libraries.. LD_PRELOAD

well i know what LD_PRELOAD is. Now suppose i have hooked a function XDrawString in the my library (Mylib.so.1) and then used the command export LD_PRELOAD=/path/mylib.so.1 Now suppose i open Xeditor by typing 'xeditor' in the console, my library is geting used, so i knw that this applilcation is... (3 Replies)
Discussion started by: manchester
3 Replies

9. OS X (Apple)

which file is sourced by bash on login (Mac OS X 10.5.3)?

Hi: So my current Python (2.52) rig is not working as intended. "echo $PATH" in bash gives me 'X'" that's not what i want, so i need to change my path. To do that, there appeared to be four choices (all in my ~/ directory--note: I'm root, it's my Mac, but i'm in a user account): .profile... (2 Replies)
Discussion started by: Alex_Land
2 Replies

10. Shell Programming and Scripting

how to include external files in tcsh

Hello Simple question about tcsh , i like to make external file that some tcsh script will read from him var=="some value" how can i make the include in tcsh files? Thanks (0 Replies)
Discussion started by: umen
0 Replies
Login or Register to Ask a Question