~ubuntu-branches/ubuntu/hardy/strace/hardy

« back to all changes in this revision

Viewing changes to process.c

  • Committer: Bazaar Package Importer
  • Author(s): Frederik Schüler, Roland McGrath, Frederik Schüler
  • Date: 2007-06-22 16:28:08 UTC
  • mfrom: (0.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070622162808-cj8oqdqq82k3pyek
Tags: 4.5.15-1
[ Roland McGrath ]
* New upstream version.
  + Fix -ff -o behavior, closes: #353935.
  + Fail when nonoption args follow -p switches, closes: #361302.
  + Fix semtimedop, closes: #340239.
  + ARM support fixes, closes: #360152, #360154.

[ Frederik Schüler ]
* Fix configure script, closes: #428997

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
35
35
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36
36
 *
37
 
 *      $Id: process.c,v 1.98 2005/08/03 11:23:43 roland Exp $
 
37
 *      $Id: process.c,v 1.104 2007/01/11 22:05:05 ldv Exp $
38
38
 */
39
39
 
40
40
#include "defs.h"
305
305
 
306
306
#endif /* HAVE_PRCTL */
307
307
 
 
308
#if defined(FREEBSD) || defined(SUNOS4) || defined(SVR4)
308
309
int
309
310
sys_gethostid(tcp)
310
311
struct tcb *tcp;
313
314
                return RVAL_HEX;
314
315
        return 0;
315
316
}
 
317
#endif /* FREEBSD || SUNOS4 || SVR4 */
316
318
 
317
319
int
318
320
sys_sethostname(tcp)
325
327
        return 0;
326
328
}
327
329
 
 
330
#if defined(ALPHA) || defined(FREEBSD) || defined(SUNOS4) || defined(SVR4)
328
331
int
329
332
sys_gethostname(tcp)
330
333
struct tcb *tcp;
338
341
        }
339
342
        return 0;
340
343
}
 
344
#endif /* ALPHA || FREEBSD || SUNOS4 || SVR4 */
341
345
 
342
346
int
343
347
sys_setdomainname(tcp)
412
416
        if (nprocs == tcbtabsize) {
413
417
                if (expand_tcbtab()) {
414
418
                        tcp->flags &= ~TCB_FOLLOWFORK;
415
 
                        fprintf(stderr, "sys_fork: tcb table full\n");
 
419
                        return 1;
416
420
                }
417
421
        }
418
422
 
474
478
                        return 0;
475
479
                if (syserror(tcp))
476
480
                        return 0;
477
 
                if ((tcpchild = alloctcb(tcp->u_rval)) == NULL) {
478
 
                        fprintf(stderr, "sys_fork: tcb table full\n");
 
481
                if ((tcpchild = alloctcb(tcp->u_rval)) == NULL)
479
482
                        return 0;
480
 
                }
481
483
                if (proc_open(tcpchild, 2) < 0)
482
484
                        droptcb(tcpchild);
483
485
        }
607
609
        }
608
610
        return 0;
609
611
}
 
612
 
 
613
int
 
614
sys_unshare(struct tcb *tcp)
 
615
{
 
616
        if (entering(tcp))
 
617
                printflags(clone_flags, tcp->u_arg[0], "CLONE_???");
 
618
        return 0;
 
619
}
610
620
#endif
611
621
 
612
622
int
694
704
                                   0x100000 | new) < 0)
695
705
                       return -1;
696
706
       return 0;
 
707
#elif defined(ARM)
 
708
       /* Some kernels support this, some (pre-2.6.16 or so) don't.  */
 
709
# ifndef PTRACE_SET_SYSCALL
 
710
#  define PTRACE_SET_SYSCALL 23
 
711
# endif
 
712
 
 
713
       if (ptrace (PTRACE_SET_SYSCALL, tcp->pid, 0, new) != 0)
 
714
                return -1;
 
715
 
 
716
       return 0;
697
717
#else
698
718
#warning Do not know how to handle change_syscall for this architecture
699
719
#endif /* architecture */
823
843
                }
824
844
                else
825
845
#endif
826
 
                if ((tcpchild = alloctcb(pid)) == NULL) {
 
846
                if (fork_tcb(tcp) || (tcpchild = alloctcb(pid)) == NULL) {
827
847
                        if (bpt)
828
848
                                clearbpt(tcp);
829
 
                        fprintf(stderr, " [tcb table full]\n");
830
849
                        kill(pid, SIGKILL); /* XXX */
831
850
                        return 0;
832
851
                }
874
893
                                        pid, tcp->pid);
875
894
                }
876
895
                else {
877
 
                        newoutf(tcpchild);
878
896
                        if (!qflag)
879
897
                                fprintf(stderr, "Process %d attached\n", pid);
880
898
                }
960
978
                        return 0;
961
979
 
962
980
                pid = tcp->u_rval;
963
 
                if ((tcpchild = alloctcb(pid)) == NULL) {
964
 
                        fprintf(stderr, " [tcb table full]\n");
 
981
                if (fork_tcb(tcp) || (tcpchild = alloctcb(pid)) == NULL) {
965
982
                        kill(pid, SIGKILL); /* XXX */
966
983
                        return 0;
967
984
                }
1030
1047
                        memcpy(tcpchild->inst, tcp->inst,
1031
1048
                                sizeof tcpchild->inst);
1032
1049
                }
1033
 
                newoutf(tcpchild);
1034
1050
                tcpchild->parent = tcp;
1035
1051
                tcp->nchildren++;
1036
1052
                if (!qflag)
1459
1475
}
1460
1476
#endif /* LINUX */
1461
1477
 
 
1478
#if defined(ALPHA) || defined(SUNOS4) || defined(SVR4)
1462
1479
int
1463
1480
sys_setpgrp(tcp)
1464
1481
struct tcb *tcp;
1470
1487
        }
1471
1488
        return 0;
1472
1489
}
 
1490
#endif /* ALPHA || SUNOS4 || SVR4 */
1473
1491
 
1474
1492
int
1475
1493
sys_getpgrp(tcp)
1578
1596
 
1579
1597
 
1580
1598
static void
1581
 
printpriv(tcp, addr, len, opt)
1582
 
struct tcb *tcp;
1583
 
long addr;
1584
 
int len;
1585
 
const struct xlat *opt;
 
1599
printpriv(struct tcb *tcp, long addr, int len, const struct xlat *opt)
1586
1600
{
1587
1601
        priv_t buf [128];
1588
1602
        int max = verbose (tcp) ? sizeof buf / sizeof buf [0] : 10;
1601
1615
        tprintf ("[");
1602
1616
 
1603
1617
        for (i = 0; i < len; ++i) {
1604
 
                char *t, *p;
 
1618
                const char *t, *p;
1605
1619
 
1606
1620
                if (i) tprintf (", ");
1607
1621
 
1699
1713
        tprintf(fmt, count, count == 1 ? "" : "s");
1700
1714
}
1701
1715
 
 
1716
#if defined(SPARC) || defined(SPARC64) || defined(SUNOS4)
1702
1717
int
1703
1718
sys_execv(tcp)
1704
1719
struct tcb *tcp;
1719
1734
        }
1720
1735
        return 0;
1721
1736
}
 
1737
#endif /* SPARC || SPARC64 || SUNOS4 */
1722
1738
 
1723
1739
int
1724
1740
sys_execve(tcp)