]> granicus.if.org Git - strace/commitdiff
2004-10-06 Roland McGrath <roland@redhat.com>
authorRoland McGrath <roland@redhat.com>
Wed, 6 Oct 2004 22:23:31 +0000 (22:23 +0000)
committerRoland McGrath <roland@redhat.com>
Wed, 6 Oct 2004 22:23:31 +0000 (22:23 +0000)
* desc.c [LINUX] (sys_epoll_create, sys_epoll_ctl, sys_epoll_wait):
New functions.
* linux/syscall.h: Declare them.
* linux/syscallent.h: Use those for epoll_* syscalls.
* linux/alpha/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/sparc64/syscallent2.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
From Ulrich Drepper <drepper@redhat.com>.
Fixes RH#134463.

13 files changed:
desc.c
linux/alpha/syscallent.h
linux/hppa/syscallent.h
linux/ia64/syscallent.h
linux/powerpc/syscallent.h
linux/s390/syscallent.h
linux/s390x/syscallent.h
linux/sparc/syscallent.h
linux/sparc64/syscallent.h
linux/sparc64/syscallent2.h
linux/syscall.h
linux/syscallent.h
linux/x86_64/syscallent.h

diff --git a/desc.c b/desc.c
index f4e92571f46300c810bc5aa5dbcab0e02c050725..d93952de3a9092d5a20559db05e337ddc3e77c8e 100644 (file)
--- a/desc.c
+++ b/desc.c
 
 #include <fcntl.h>
 #include <sys/file.h>
+#ifdef LINUX
+#include <inttypes.h>
+#include <sys/epoll.h>
+#endif
 
 #if HAVE_LONG_LONG_OFF_T
 /*
@@ -549,6 +553,100 @@ struct tcb *tcp;
 }
 #endif
 
+static struct xlat epollctls[] = {
+       { EPOLL_CTL_ADD,        "EPOLL_CTL_ADD" },
+       { EPOLL_CTL_MOD,        "EPOLL_CTL_MOD" },
+       { EPOLL_CTL_DEL,        "EPOLL_CTL_DEL" },
+       { 0,                    NULL            }
+};
+
+static struct xlat epollevents[] = {
+       { EPOLLIN,      "EPOLLIN"       },
+       { EPOLLPRI,     "EPOLLPRI"      },
+       { EPOLLOUT,     "EPOLLOUT"      },
+       { EPOLLRDNORM,  "EPOLLRDNORM"   },
+       { EPOLLRDBAND,  "EPOLLRDBAND"   },
+       { EPOLLWRNORM,  "EPOLLWRNORM"   },
+       { EPOLLWRBAND,  "EPOLLWRBAND"   },
+       { EPOLLMSG,     "EPOLLMSG"      },
+       { EPOLLERR,     "EPOLLERR"      },
+       { EPOLLHUP,     "EPOLLHUP"      },
+       { EPOLLONESHOT, "EPOLLONESHOT"  },
+       { EPOLLET,      "EPOLLET"       },
+       { 0,            NULL            }
+};
+
+int
+sys_epoll_create(tcp)
+struct tcb *tcp;
+{
+       if (entering(tcp))
+               tprintf("%ld", tcp->u_arg[0]);
+       return 0;
+}
+
+static void
+print_epoll_event(ev)
+struct epoll_event *ev;
+{
+       tprintf("{");
+       if (printflags(epollevents, ev->events) == 0)
+               tprintf("0");
+       /* We cannot know what format the program uses, so print u32 and u64
+          which will cover every value.  */
+       tprintf(", {u32=%" PRIu32 ", u64=%" PRIu64 "}}",
+               ev->data.u32, ev->data.u64);
+}
+
+int
+sys_epoll_ctl(tcp)
+struct tcb *tcp;
+{
+       if (entering(tcp)) {
+               struct epoll_event ev;
+               tprintf("%ld, ", tcp->u_arg[0]);
+                printxval(epollctls, tcp->u_arg[1], "EPOLL_CTL_???");
+               tprintf(", %ld, ", tcp->u_arg[2]);
+               if (tcp->u_arg[3] == 0)
+                       tprintf("NULL");
+               else if (umove(tcp, tcp->u_arg[3], &ev) < 0)
+                       tprintf("{...}");
+               else
+                       print_epoll_event(&ev);
+       }
+       return 0;
+}
+
+int
+sys_epoll_wait(tcp)
+struct tcb *tcp;
+{
+       if (entering(tcp))
+               tprintf("%ld, ", tcp->u_arg[0]);
+       else {
+               if (syserror(tcp))
+                       tprintf("%lx", tcp->u_arg[1]);
+               else if (tcp->u_rval == 0)
+                       tprintf("{}");
+               else {
+                       struct epoll_event evs[tcp->u_rval];
+                       if (umove(tcp, tcp->u_arg[1], evs) < 0)
+                               tprintf("{...}");
+                       else {
+                               unsigned long i;
+                               tprintf("{");
+                               for (i = 0; i < tcp->u_rval; ++i) {
+                                       if (i > 0)
+                                               tprintf(", ");
+                                       print_epoll_event(&evs[i]);
+                               }
+                               tprintf("}");
+                       }
+               }
+               tprintf(", %ld, %ld", tcp->u_arg[2], tcp->u_arg[3]);
+       }
+       return 0;
+}
 #endif /* LINUX */
 
 int
index bd9e4efc8af05adf92a47bd8dba95453cec9b7c7..2264fc145efee6889e8c0fc240a15be51eb80fae 100644 (file)
        { 5,    0,      printargs,              "SYS_404"               }, /* 404 */
        { 1,    TP,     sys_exit,               "exit_group"            }, /* 405 */
        { 4,    0,      printargs,              "lookup_dcookie"        }, /* 406 */
-       { 1,    0,      printargs,              "epoll_create"          }, /* 407 */
-       { 4,    0,      printargs,              "epoll_ctl"             }, /* 408 */
-       { 4,    0,      printargs,              "epoll_wait"            }, /* 409 */
+       { 1,    0,      sys_epoll_create,       "epoll_create"          }, /* 407 */
+       { 4,    0,      sys_epoll_ctl,          "epoll_ctl"             }, /* 408 */
+       { 4,    0,      sys_epoll_wait,         "epoll_wait"            }, /* 409 */
        { 5,    0,      sys_remap_file_pages,   "remap_file_pages"      }, /* 410 */
        { 1,    0,      printargs,              "set_tid_address"       }, /* 411 */
        { 0,    0,      printargs,              "restart_syscall"       }, /* 412 */
index 31ade6e0e89c939e9b4ae33262cc6be68eb0c966..a81f4cad75149c9e0e8c03b094e2a81b5f4bb3d6 100644 (file)
        { 1,    0,      printargs,              "free_hugepages"        }, /* 221 */
        { 1,    TP,     sys_exit,               "exit_group"            }, /* 222 */
        { 4,    0,      printargs,              "lookup_dcookie"        }, /* 223 */
-       { 1,    0,      printargs,              "epoll_create"          }, /* 224 */
-       { 4,    0,      printargs,              "epoll_ctl"             }, /* 225 */
-       { 4,    0,      printargs,              "epoll_wait"            }, /* 226 */
+       { 1,    0,      sys_epoll_create,       "epoll_create"          }, /* 224 */
+       { 4,    0,      sys_epoll_ctl,          "epoll_ctl"             }, /* 225 */
+       { 4,    0,      sys_epoll_wait,         "epoll_wait"            }, /* 226 */
        { 5,    0,      printargs,              "remap_file_pages"      }, /* 227 */
        { 5,    0,      printargs,              "semtimedop"            }, /* 228 */
        { 5,    0,      printargs,              "SYS_229"               }, /* 229 */
index 099a39851aa3e6d439460c7807a7fd418aa7d033..507b6fa0f3acdc0b2839624d46728964fddc0112 100644 (file)
        { 5,    0,      printargs,              "io_getevents"  }, /* 1240 */
        { 3,    0,      printargs,              "io_submit"     }, /* 1241 */
        { 3,    0,      printargs,              "io_cancel"     }, /* 1242 */
-       { 1,    0,      printargs,              "epoll_create"  }, /* 1243 */
-       { 4,    0,      printargs,              "epoll_ctl"     }, /* 1244 */
-       { 4,    0,      printargs,              "epoll_wait"    }, /* 1245 */
+       { 1,    0,      sys_epoll_create,       "epoll_create"  }, /* 1243 */
+       { 4,    0,      sys_epoll_ctl,          "epoll_ctl"     }, /* 1244 */
+       { 4,    0,      sys_epoll_wait,         "epoll_wait"    }, /* 1245 */
        { 8,    0,      printargs,              "SYS_1246"      }, /* 1246 */
        { 8,    0,      printargs,              "SYS_1247"      }, /* 1247 */
        { 8,    0,      printargs,              "SYS_1248"      }, /* 1248 */
index 1e2269092d39b151f9d8f506cb13241fe12ace7f..31a3e397b2e19107a294787a1d52a4f415f9cfb7 100644 (file)
        { 6,    0,      printargs,              "fadvise64"             }, /* 233 */
        { 1,    TP,     sys_exit,               "exit_group"            }, /* 234 */
        { 4,    0,      printargs,              "lookup_dcookie"        }, /* 235 */
-       { 1,    0,      printargs,              "epoll_create"          }, /* 236 */
-       { 4,    0,      printargs,              "epoll_ctl"             }, /* 237 */
-       { 4,    0,      printargs,              "epoll_wait"            }, /* 238 */
+       { 1,    0,      sys_epoll_create,       "epoll_create"          }, /* 236 */
+       { 4,    0,      sys_epoll_ctl,          "epoll_ctl"             }, /* 237 */
+       { 4,    0,      sys_epoll_wait,         "epoll_wait"            }, /* 238 */
        { 5,    0,      sys_remap_file_pages,   "remap_file_pages"      }, /* 239 */
        { 3,    0,      sys_timer_create,       "timer_create"          }, /* 240 */
        { 4,    0,      sys_timer_settime,      "timer_settime"         }, /* 241 */
index b04c02eddcbd908362c54b0a47c7303cac9b4794..238fec468c8e87e7e083a5c1ebb974c2306dfe03 100644 (file)
        { 3,    0,      printargs,              "io_submit"     }, /* 246 */
        { 3,    0,      printargs,              "io_cancel"     }, /* 247 */
        { 1,    TP,     sys_exit,               "exit_group"    }, /* 248 */
-       { 1,    0,      printargs,              "epoll_create"  }, /* 249 */
-       { 4,    0,      printargs,              "epoll_ctl"     }, /* 250 */
-       { 4,    0,      printargs,              "epoll_wait"    }, /* 251 */
+       { 1,    0,      sys_epoll_create,       "epoll_create"  }, /* 249 */
+       { 4,    0,      sys_epoll_ctl,          "epoll_ctl"     }, /* 250 */
+       { 4,    0,      sys_epoll_wait,         "epoll_wait"    }, /* 251 */
        { 1,    0,      printargs,              "set_tid_address"}, /* 252 */
        { 5,    0,      printargs,              "fadvise64"     }, /* 253 */
        { 3,    0,      sys_timer_create,       "timer_create"  }, /* 254 */
index f56f232eb9ae666a47c25457c65054694441d282..438a39cdf1e2a53d7c534ad3ef46f19b0d55ae7e 100644 (file)
        { 3,    0,      printargs,              "io_submit"     }, /* 246 */
        { 3,    0,      printargs,              "io_cancel"     }, /* 247 */
        { 1,    TP,     sys_exit,               "exit_group"    }, /* 248 */
-       { 1,    0,      printargs,              "epoll_create"  }, /* 249 */
-       { 4,    0,      printargs,              "epoll_ctl"     }, /* 250 */
-       { 4,    0,      printargs,              "epoll_wait"    }, /* 251 */
+       { 1,    0,      sys_epoll_create,       "epoll_create"  }, /* 249 */
+       { 4,    0,      sys_epoll_ctl,          "epoll_ctl"     }, /* 250 */
+       { 4,    0,      sys_epoll_wait,         "epoll_wait"    }, /* 251 */
        { 1,    0,      printargs,              "set_tid_address"}, /* 252 */
        { 5,    0,      printargs,              "fadvise64"     }, /* 253 */
        { 3,    0,      sys_timer_create,       "timer_create"  }, /* 254 */
index 8e1555f0a29e427103b56f30c6dc8dc6d1927165..28729464f4a43e61d8d6491d58c2399d89e09505 100644 (file)
        { 2,    0,      sys_init_module,"init_module" },        /* 190 */
        { 1,    0,      sys_personality,"personality" },        /* 191 */
        { 5,    0,      sys_remap_file_pages,"remap_file_pages" },/* 192 */
-       { 1,    0,      printargs,      "epoll_create" },               /* 193 */
-       { 4,    0,      printargs,      "epoll_ctl" },          /* 194 */
-       { 4,    0,      printargs,      "epoll_wait" },         /* 195 */
+       { 1,    0,      sys_epoll_create,"epoll_create" },      /* 193 */
+       { 4,    0,      sys_epoll_ctl,  "epoll_ctl" },          /* 194 */
+       { 4,    0,      sys_epoll_wait, "epoll_wait" },         /* 195 */
        { 2,    0,      sys_ulimit,     "ulimit" },             /* 196 */
        { 0,    0,      sys_getppid,    "getppid" },            /* 197 */
        { 3,    TS,     sys_sigaction,  "sigaction" },          /* 198 */
index 8e1555f0a29e427103b56f30c6dc8dc6d1927165..28729464f4a43e61d8d6491d58c2399d89e09505 100644 (file)
        { 2,    0,      sys_init_module,"init_module" },        /* 190 */
        { 1,    0,      sys_personality,"personality" },        /* 191 */
        { 5,    0,      sys_remap_file_pages,"remap_file_pages" },/* 192 */
-       { 1,    0,      printargs,      "epoll_create" },               /* 193 */
-       { 4,    0,      printargs,      "epoll_ctl" },          /* 194 */
-       { 4,    0,      printargs,      "epoll_wait" },         /* 195 */
+       { 1,    0,      sys_epoll_create,"epoll_create" },      /* 193 */
+       { 4,    0,      sys_epoll_ctl,  "epoll_ctl" },          /* 194 */
+       { 4,    0,      sys_epoll_wait, "epoll_wait" },         /* 195 */
        { 2,    0,      sys_ulimit,     "ulimit" },             /* 196 */
        { 0,    0,      sys_getppid,    "getppid" },            /* 197 */
        { 3,    TS,     sys_sigaction,  "sigaction" },          /* 198 */
index 8e1555f0a29e427103b56f30c6dc8dc6d1927165..28729464f4a43e61d8d6491d58c2399d89e09505 100644 (file)
        { 2,    0,      sys_init_module,"init_module" },        /* 190 */
        { 1,    0,      sys_personality,"personality" },        /* 191 */
        { 5,    0,      sys_remap_file_pages,"remap_file_pages" },/* 192 */
-       { 1,    0,      printargs,      "epoll_create" },               /* 193 */
-       { 4,    0,      printargs,      "epoll_ctl" },          /* 194 */
-       { 4,    0,      printargs,      "epoll_wait" },         /* 195 */
+       { 1,    0,      sys_epoll_create,"epoll_create" },      /* 193 */
+       { 4,    0,      sys_epoll_ctl,  "epoll_ctl" },          /* 194 */
+       { 4,    0,      sys_epoll_wait, "epoll_wait" },         /* 195 */
        { 2,    0,      sys_ulimit,     "ulimit" },             /* 196 */
        { 0,    0,      sys_getppid,    "getppid" },            /* 197 */
        { 3,    TS,     sys_sigaction,  "sigaction" },          /* 198 */
index 13326cf6040f182c57beab1b6569f2c665d58402..0afdc70049803b74bfb238d38af2bbeb792321d0 100644 (file)
@@ -96,6 +96,7 @@ int sys_clock_gettime(), sys_clock_getres(), sys_clock_nanosleep();
 int sys_semtimedop(), sys_statfs64(), sys_fstatfs64(), sys_tgkill();
 int sys_mq_open(), sys_mq_timedsend(), sys_mq_timedreceive();
 int sys_mq_notify(), sys_mq_getsetattr();
+int sys_epoll_create(), sys_epoll_ctl(), sys_epoll_wait();
 int sys_waitid();
 
 /* sys_socketcall subcalls */
index 67fcfa2308eb1397603ecdaae93981fb77ca8959..7fcaf6d3ba11065689331804d0ec5a8afe3e3118 100644 (file)
        { 5,    0,      printargs,              "SYS_251"       }, /* 251 */
        { 1,    TP,     sys_exit,               "exit_group"    }, /* 252 */
        { 4,    0,      printargs,              "lookup_dcookie"}, /* 253 */
-       { 1,    0,      printargs,              "epoll_create"  }, /* 254 */
-       { 4,    0,      printargs,              "epoll_ctl"     }, /* 255 */
-       { 4,    0,      printargs,              "epoll_wait"    }, /* 256 */
+       { 1,    0,      sys_epoll_create,       "epoll_create"  }, /* 254 */
+       { 4,    0,      sys_epoll_ctl,          "epoll_ctl"     }, /* 255 */
+       { 4,    0,      sys_epoll_wait,         "epoll_wait"    }, /* 256 */
        { 5,    0,      sys_remap_file_pages,   "remap_file_pages"}, /* 257 */
        { 1,    0,      printargs,              "set_tid_address"}, /* 258 */
        { 3,    0,      sys_timer_create,       "timer_create"  }, /* 259 */
index 9c1deec9911f16b263b07573f9dc78eb71583694..87ee17048228159c0cacad9dc8405e74653f2cc4 100644 (file)
        { 3,    0,      printargs,              "io_cancel"     }, /* 210 */
        { 1,    0,      sys_get_thread_area,    "get_thread_area" }, /* 211 */
        { 4,    0,      printargs,              "lookup_dcookie"}, /* 212 */
-       { 1,    0,      printargs,              "epoll_create"  }, /* 213 */
-       { 4,    0,      printargs,              "epoll_ctl"     }, /* 214 */
-       { 4,    0,      printargs,              "epoll_wait"    }, /* 215 */
+       { 1,    0,      sys_epoll_create,       "epoll_create"  }, /* 213 */
+       { 4,    0,      printargs,              "epoll_ctl_old" }, /* 214 */
+       { 4,    0,      printargs,              "epoll_wait_old"}, /* 215 */
        { 5,    0,      sys_remap_file_pages,   "remap_file_pages"}, /* 216 */
        { 4,    0,      sys_getdents64,         "getdents64"    }, /* 217 */
        { 5,    0,      printargs,              "SYS_218"       }, /* 218 */
        { 2,    0,      sys_clock_getres,       "clock_getres"  }, /* 229 */
        { 4,    0,      sys_clock_nanosleep,    "clock_nanosleep"}, /* 230 */
        { 5,    0,      printargs,              "exit_group"    }, /* 231 */
-       { 5,    0,      printargs,              "epoll_wait"    }, /* 232 */
-       { 5,    0,      printargs,              "epoll_ctl"     }, /* 233 */
+       { 5,    0,      sys_epoll_wait,         "epoll_wait"    }, /* 232 */
+       { 5,    0,      sys_epoll_ctl,          "epoll_ctl"     }, /* 233 */
        { 5,    0,      printargs,              "tgkill"        }, /* 234 */
        { 5,    0,      printargs,              "utimes"        }, /* 235 */
        { 5,    0,      printargs,              "vserver"       }, /* 236 */