~ubuntu-branches/ubuntu/karmic/strace/karmic

« back to all changes in this revision

Viewing changes to desc.c

  • Committer: Bazaar Package Importer
  • Author(s): Pedro Fragoso, Pedro Fragoso, Martin Pitt
  • Date: 2008-12-09 11:06:58 UTC
  • mfrom: (0.1.5 upstream) (2.1.2 lenny)
  • Revision ID: james.westby@ubuntu.com-20081209110658-4oy0si4bs8yerqg1
Tags: 4.5.17+cvs080723-2ubuntu1
[ Pedro Fragoso ]
* Merge from Debian unstable (LP: #259933), Ubuntu remaining changes:
  - Add lpia as supported architecture

[ Martin Pitt ]
* file.c: Apply patch from upstream CVS to build on current kernels,
  which don't have linux/dirent.h any more.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28
28
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
29
 *
30
 
 *      $Id: desc.c,v 1.27 2007/01/11 23:19:55 ldv Exp $
 
30
 *      $Id: desc.c,v 1.33 2007/11/01 21:52:20 roland Exp $
31
31
 */
32
32
 
33
33
#include "defs.h"
242
242
}
243
243
#endif
244
244
 
245
 
static const char *
246
 
sprintflags(const struct xlat *xlat, int flags)
247
 
{
248
 
        static char outstr[1024];
249
 
        const char *sep;
250
 
 
251
 
        strcpy(outstr, "flags ");
252
 
        sep = "";
253
 
        for (; xlat->str; xlat++) {
254
 
                if ((flags & xlat->val) == xlat->val) {
255
 
                        sprintf(outstr + strlen(outstr),
256
 
                                "%s%s", sep, xlat->str);
257
 
                        sep = "|";
258
 
                        flags &= ~xlat->val;
259
 
                }
260
 
        }
261
 
        if (flags)
262
 
                sprintf(outstr + strlen(outstr),
263
 
                        "%s%#x", sep, flags);
264
 
        return outstr;
265
 
}
266
 
 
267
245
/*
268
246
 * low bits of the open(2) flags define access mode,
269
247
 * other bits are real flags.
356
334
                case F_GETFD:
357
335
                        if (tcp->u_rval == 0)
358
336
                                return 0;
359
 
                        tcp->auxstr = sprintflags(fdflags, tcp->u_rval);
 
337
                        tcp->auxstr =
 
338
                                sprintflags("flags ", fdflags, tcp->u_rval);
360
339
                        return RVAL_HEX|RVAL_STR;
361
340
                case F_GETFL:
362
341
                        tcp->auxstr = sprint_open_modes(tcp->u_rval);
476
455
                }
477
456
                free(fds);
478
457
                tprintf(", ");
479
 
                printtv_bitness(tcp, args[4], bitness);
 
458
                printtv_bitness(tcp, args[4], bitness, 0);
480
459
        }
481
460
        else
482
461
        {
669
648
        return 0;
670
649
}
671
650
 
672
 
int
673
 
sys_epoll_wait(tcp)
 
651
static void
 
652
epoll_wait_common(tcp)
674
653
struct tcb *tcp;
675
654
{
676
655
        if (entering(tcp))
708
687
                }
709
688
                tprintf(", %ld, %ld", tcp->u_arg[2], tcp->u_arg[3]);
710
689
        }
 
690
}
 
691
 
 
692
int
 
693
sys_epoll_wait(tcp)
 
694
struct tcb *tcp;
 
695
{
 
696
        epoll_wait_common(tcp);
 
697
        return 0;
 
698
}
 
699
 
 
700
int
 
701
sys_epoll_pwait(tcp)
 
702
struct tcb *tcp;
 
703
{
 
704
        epoll_wait_common(tcp);
 
705
        if (exiting(tcp))
 
706
                print_sigset(tcp, tcp->u_arg[4], 0);
711
707
        return 0;
712
708
}
713
709
 
820
816
}
821
817
 
822
818
int
823
 
sys_io_getevents(tcp)
824
 
struct tcb *tcp;
 
819
sys_io_getevents(struct tcb * tcp)
825
820
{
826
821
        if (entering(tcp)) {
827
822
                tprintf("%ld, %ld, %ld, ", tcp->u_arg[0], tcp->u_arg[1],
855
850
#endif
856
851
                }
857
852
 
858
 
                if (tcp->u_arg[4] == 0)
859
 
                        tprintf("NULL");
860
 
                else {
861
 
                        struct timespec to;
862
 
                        if (umove(tcp, tcp->u_arg[4], &to) == 0)
863
 
                                tprintf("{%lu, %lu}", to.tv_sec, to.tv_nsec);
864
 
                        else
865
 
                                tprintf("{...}");
866
 
                }
 
853
                print_timespec(tcp, tcp->u_arg[4]);
867
854
        }
868
855
        return 0;
869
856
}
881
868
sys_pselect6(struct tcb *tcp)
882
869
{
883
870
        int rc = decode_select(tcp, tcp->u_arg, BITNESS_CURRENT);
884
 
        if (exiting(tcp)) {
 
871
        if (entering(tcp)) {
885
872
                struct {
886
873
                        void *ss;
887
874
                        unsigned long len;
890
877
                        tprintf(", %#lx", tcp->u_arg[5]);
891
878
                else {
892
879
                        tprintf(", {");
893
 
                        if (data.len < sizeof(sigset_t))
 
880
                        if (data.len < sizeof(long))
894
881
                                tprintf("%#lx", (long)data.ss);
895
882
                        else
896
883
                                print_sigset(tcp, (long)data.ss, 0);
899
886
        }
900
887
        return rc;
901
888
}
 
889
 
 
890
int
 
891
sys_eventfd(tcp)
 
892
struct tcb *tcp;
 
893
{
 
894
        if (entering(tcp))
 
895
                tprintf("%lu", tcp->u_arg[0]);
 
896
        return 0;
 
897
}
902
898
#endif