summaryrefslogtreecommitdiffstats
path: root/tapset/aux_syscalls.stp
diff options
context:
space:
mode:
authorMark Wielaard <mwielaard@redhat.com>2008-05-20 21:58:04 +0200
committerMark Wielaard <mwielaard@redhat.com>2008-05-20 21:58:04 +0200
commitfc5a2d42b6cc46a9d4f7f3919ddc74ce70ad2a66 (patch)
tree9ed4c1e26b51d6e3a861f878d622971de157f79b /tapset/aux_syscalls.stp
parent3bf6ac451c7eecc5184e7823f29a293b7df53fa0 (diff)
downloadsystemtap-steved-fc5a2d42b6cc46a9d4f7f3919ddc74ce70ad2a66.tar.gz
systemtap-steved-fc5a2d42b6cc46a9d4f7f3919ddc74ce70ad2a66.tar.xz
systemtap-steved-fc5a2d42b6cc46a9d4f7f3919ddc74ce70ad2a66.zip
PR5001: Remove _stp_ctime and always use ctime.
Diffstat (limited to 'tapset/aux_syscalls.stp')
-rw-r--r--tapset/aux_syscalls.stp112
1 files changed, 56 insertions, 56 deletions
diff --git a/tapset/aux_syscalls.stp b/tapset/aux_syscalls.stp
index da72a7ff..ec7fdcb0 100644
--- a/tapset/aux_syscalls.stp
+++ b/tapset/aux_syscalls.stp
@@ -60,77 +60,77 @@ function _struct_timezone_u:string(uaddr:long)
%}
%{
-static const int days_in_month[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
-static void _stp_ctime(time_t t, char *buf, int buflen)
-{
- int mon=1, day, hour, min, sec, num, d, year = 1970;
-
- sec = t % 60;
- min = t/60 % 60;
- hour = t/(60*60) % 24;
- day = t/(24*60*60);
-
- while(1) {
- d = (!(year % 4) && ((year % 100) || !(year % 400))) ? 366 : 365;
- if (day >= d)
- day -= d;
- else
- break;
- year++;
- }
- while (mon < 12) {
- num = days_in_month[mon-1];
- if (mon == 2 && d == 366)
- num++;
- if (day >= num)
- day -= num;
- else
- break;
- mon++;
- }
-
- snprintf(buf, buflen, "%4d/%02d/%02d-%02d:%02d:%02d", year, mon, day+1, hour, min, sec);
- buf[buflen-1] = 0;
-}
+ // Needed for the following four functions
+ // _struct_utimbuf_actime, _struct_utimbuf_modtime,
+ // _struct_compat_utimbuf_actime, _struct_compat_utimbuf_modtime
+ #include <linux/utime.h>
%}
-function _struct_utimbuf_u:string(uaddr:long)
+// Returns the value of the actime field of a utimbuf in user space
+// at the given address, or zero on when userspace data is not accessible.
+function _struct_utimbuf_actime:long(uaddr:long)
%{ /* pure */
- #include <linux/utime.h>
struct utimbuf ubuf;
- static char abuf[24], mbuf[24];
char *ptr = (char *)(unsigned long)THIS->uaddr;
if (ptr == NULL)
- strlcpy (THIS->__retvalue, "NULL", MAXSTRINGLEN);
- else {
- if(_stp_copy_from_user((char*)&ubuf,ptr,sizeof(ubuf)) == 0) {
- _stp_ctime(ubuf.actime, abuf, 24);
- _stp_ctime(ubuf.modtime, mbuf, 24);
- snprintf(THIS->__retvalue, MAXSTRINGLEN, "[%s, %s]", abuf, mbuf);
- } else
- strlcpy (THIS->__retvalue, "UNKNOWN", MAXSTRINGLEN);
- }
+ THIS->__retvalue = 0;
+ else
+ if(_stp_copy_from_user((char*)&ubuf,ptr,sizeof(ubuf)) == 0)
+ THIS->__retvalue = ubuf.actime;
+ else
+ THIS->__retvalue = 0;
%}
-function _struct_compat_utimbuf_u:string(uaddr:long)
+// Returns the value of the modtime field of a utimbuf in user space
+// at the given address, or zero on when userspace data is not accessible.
+function _struct_utimbuf_modtime:long(uaddr:long)
+%{ /* pure */
+ struct utimbuf ubuf;
+ char *ptr = (char *)(unsigned long)THIS->uaddr;
+
+ if (ptr == NULL)
+ THIS->__retvalue = 0;
+ else
+ if(_stp_copy_from_user((char*)&ubuf,ptr,sizeof(ubuf)) == 0)
+ THIS->__retvalue = ubuf.modtime;
+ else
+ THIS->__retvalue = 0;
+%}
+
+// Returns the value of the actime field of a compat_utimbuf in user space
+// at the given address, or zero on when userspace data is not accessible.
+function _struct_compat_utimbuf_actime:long(uaddr:long)
%{ /* pure */
#ifdef CONFIG_COMPAT
- #include <linux/utime.h>
struct compat_utimbuf ubuf;
- static char abuf[24], mbuf[24];
char *ptr = (char *)(unsigned long)THIS->uaddr;
if (ptr == NULL)
- strlcpy (THIS->__retvalue, "NULL", MAXSTRINGLEN);
- else {
- if(_stp_copy_from_user((char*)&ubuf,ptr,sizeof(ubuf)) == 0) {
- _stp_ctime(ubuf.actime, abuf, 24);
- _stp_ctime(ubuf.modtime, mbuf, 24);
- snprintf(THIS->__retvalue, MAXSTRINGLEN, "[%s, %s]", abuf, mbuf);
- } else
- strlcpy (THIS->__retvalue, "UNKNOWN", MAXSTRINGLEN);
- }
+ THIS->__retvalue = 0;
+ else
+ if(_stp_copy_from_user((char*)&ubuf,ptr,sizeof(ubuf)) == 0)
+ THIS->__retvalue = ubuf.actime;
+ else
+ THIS->__retvalue = 0;
+#endif
+%}
+
+// Returns the value of the modtime field of a compat_utimbuf in user space
+// at the given address, or zero on when userspace data is not accessible.
+function _struct_compat_utimbuf_modtime:long(uaddr:long)
+%{ /* pure */
+#ifdef CONFIG_COMPAT
+ struct compat_utimbuf ubuf;
+ char *ptr = (char *)(unsigned long)THIS->uaddr;
+
+ if (ptr == NULL)
+ THIS->__retvalue = 0;
+ else
+ if(_stp_copy_from_user((char*)&ubuf,ptr,sizeof(ubuf)) == 0)
+ THIS->__retvalue = ubuf.modtime;
+ else
+ THIS->__retvalue = 0;
#endif
%}