Sponsored Content
Top Forums Programming [FreeBSD] ptrace( ) - Device busy Post 34028 by Driver on Thursday 30th of January 2003 04:26:27 PM
Old 01-30-2003
Thanks for your reply!
I actually tried it using sleep( ) before, but that didn't have any effect. Using wait( ), as you suggested, did the trick. Now I have a new problem: If I pass low addresses as third parameter, I always get ``Bad address'' errors. While trying to find the root of this problem, I happened to pass the uninitialised variable ``i'' as address (I used it as loop counter before and when I commented that out, the value became, of course, undefined :-) )...
It worked! Strangely, the value of ``i'' was 671482112.
Quotation from the man page:

Quote:
The addr argument specifies the address (in the traced process' virtual address space) at which the read is to be done. This address does not have to meet any alignment constraints.
I don't believe that my tiny ``foobar'' program uses > 640mb of memory. Even if this was an absolute address (contradicting the man page), I don't have that much. While I'm typing this, I have the program trying all ``addresses'' from 0 to 1000000000 - It's at 115xxxxxx now and no ``address'' was valid. What the heck is going here?

Code:
Code:
...
int i;
...
printf( "Attempting to read...\n" );
wait( NULL );
rc = ptrace( PT_READ_D, child, ( void* )i, 0 );
if( rc == -1 && errno ) {
  ERR( "ptrace", child );
}
printf( "%p: %d\n", ( void* )i, rc );

Output:
Code:
Attaching to 6487
Stopping..
Attempting to read...
0x28060100: -716130182

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

umount, device busy, but..

I'm trying to unmount a file system, but umount says the device is busy. A fuser -c /myfs tells me that nothing on this fs is in use. Any idea? Oh, and btw, why isn't my signature beeing displayed? Show user's signature is enabled and I have entered one :/ (10 Replies)
Discussion started by: sTorm
10 Replies

2. HP-UX

Cannot umount - device busy

Anyone have any idea why I cannot umount a directory even though fuser shows no process attached to it? fuser -cu /data/oracle/GMPSHRDM/export /data/oracle/GMPSHRDM/export: umount /data/oracle/GMPSHRDM/export umount: cannot unmount /data/oracle/GMPSHRDM/export : Device busy umount:... (2 Replies)
Discussion started by: keelba
2 Replies

3. UNIX for Dummies Questions & Answers

Device or resource busy??

Hi, I'm trying to do a sharity mount to mount a terastation network drive. I'm getting a Device or resource busy message after my mount command. Please see output below... # /usr/local/sharity3/bin/sharity mount smb://labbackup01/bakup_data /mnt/labbackup01 Device or resource busy.... (2 Replies)
Discussion started by: orahi001
2 Replies

4. UNIX Desktop Questions & Answers

cygwin /dev/ttyS2: Device or resource busy

Ciao a tutti!!! il mio problema è questo: sto cercando di inviare dei comandi AT da PC a cellulare utilizzando il bluetooth e cygwin e vorrei visualizzare le risposte nella shell bash. Per farlo apro due terminali utilizzando le seguente istruzioni: xterm & Sul primo scrivo cat /dev/ttyS2 ... (0 Replies)
Discussion started by: blianna
0 Replies

5. UNIX and Linux Applications

/dev/ttyS2 device or resource busy

Ciao a tutti!!! il mio problema è questo: sto cercando di inviare dei comandi AT da PC a cellulare utilizzando il bluetooth e cygwin e vorrei visualizzare le risposte nella shell bash. Per farlo apro due terminali utilizzando le seguente istruzioni: xterm & Sul primo scrivo cat /dev/ttyS2 ... (1 Reply)
Discussion started by: blianna
1 Replies

6. UNIX Desktop Questions & Answers

cygwin error device or resource busy

Hello!!! My problem is: i'm trying to send At commands from Pc to mobile phone using bluetooth and cygwin and i would like to read the device's answers on the shell bash. And so, i open two terminals in this way: xterm & In the first i write: cat /dev/ttyS2 because the device is... (9 Replies)
Discussion started by: blianna
9 Replies

7. Solaris

CDROM will not eject - says device busy

Hi, I've seen similar posts on this board about ejecting CDROMs but I've tried the solutions people suggested but still cannot eject the CD. It's stuck in a production box so I can't reboot it... bash-3.00# eject -f cdrom /vol/dev/dsk/c0t0d0/sol_10_106_sparc/s0: Device busy bash-3.00#... (14 Replies)
Discussion started by: jimmy54321
14 Replies

8. Hardware

/dev/ttyS0: Device or resource busy

hello to everybody I have Ubuntu Lucid 10.04 installed on my Desktop and I have a PCI serial card in my computer and it has only one serial port. Actually I want to use this serial port for the serial communication and for that I executed this command : $ setserial -g /dev/ttyS and I... (0 Replies)
Discussion started by: piyush011
0 Replies

9. HP-UX

Failed to open tape device /dev/rmt/0mn:Device busy (errno = 16)

Hi, Unable to make tape backup, please help. /opt/ignite/bin/make_tape_recovery -a /dev/rmt/?mn -I -v -m tar -x inc_entire=vg00 * Creating local directories for configuration files and archive. ======= 04/25/16 16:28:08 IST Started /opt/ignite/bin/make_tape_recovery. (Mon... (4 Replies)
Discussion started by: anuragr
4 Replies

10. UNIX for Beginners Questions & Answers

Mount : Device busy

mount -f nfs 1234:/export/ert /der/fr/ert mount : /der/fr/ert: device busy normally I will then do an fuser filesystem and kill the pids, which I did. now if I do an fuser /der/fr/ert I get the mount point and no pid > fuser /der/fr/ert /der/fr/ert: but it... (1 Reply)
Discussion started by: goya
1 Replies
explain_ptrace_or_die(3)				     Library Functions Manual					  explain_ptrace_or_die(3)

NAME
explain_ptrace_or_die - process trace and report errors SYNOPSIS
#include <libexplain/ptrace.h> long explain_ptrace_or_die(int request, pid_t pid, void *addr, void *data); long explain_ptrace_on_error(int request, pid_t pid, void *addr, void *data); DESCRIPTION
The explain_ptrace_or_die function is used to call the ptrace(2) system call. On failure an explanation will be printed to stderr, obtained from the explain_ptrace(3) function, and then the process terminates by calling exit(EXIT_FAILURE). The explain_ptrace_on_error function is used to call the ptrace(2) system call. On failure an explanation will be printed to stderr, obtained from the explain_ptrace(3) function, but still returns to the caller. request The request, exactly as to be passed to the ptrace(2) system call. pid The pid, exactly as to be passed to the ptrace(2) system call. addr The addr, exactly as to be passed to the ptrace(2) system call. data The data, exactly as to be passed to the ptrace(2) system call. RETURN VALUE
The explain_ptrace_or_die function only returns on success, see ptrace(2) for more information. On failure, prints an explanation and exits, it does not return. The explain_ptrace_on_error function always returns the value return by the wrapped ptrace(2) system call. EXAMPLE
The explain_ptrace_or_die function is intended to be used in a fashion similar to the following example: long result = explain_ptrace_or_die(request, pid, addr, data); SEE ALSO
ptrace(2) process trace explain_ptrace(3) explain ptrace(2) errors exit(2) terminate the calling process COPYRIGHT
libexplain version 0.52 Copyright (C) 2010 Peter Miller explain_ptrace_or_die(3)
All times are GMT -4. The time now is 05:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy