]> granicus.if.org Git - procps-ng/commitdiff
new gcc+ld+gas features
authoralbert <>
Wed, 15 Jan 2003 10:52:39 +0000 (10:52 +0000)
committeralbert <>
Wed, 15 Jan 2003 10:52:39 +0000 (10:52 +0000)
proc/devname.c
proc/library.map [new file with mode: 0644]
proc/procps.h
proc/readproc.c

index 162ce2cd46847775aa271bb4234b6c68d1efd21f..4cd2ae8e2084c569342d8b9acc8772a654e28263 100644 (file)
@@ -27,8 +27,8 @@
 
 /* Who uses what:
  *
- * tty_to_dev   oldps, w (there is a fancy version in ps)
- * dev_to_tty   oldps, top, ps
+ * tty_to_dev   w (there is a fancy version in ps)
+ * dev_to_tty   top, ps
  */
 
 typedef struct tty_map_node {
diff --git a/proc/library.map b/proc/library.map
new file mode 100644 (file)
index 0000000..91845c5
--- /dev/null
@@ -0,0 +1,4 @@
+_3_1_5 {
+  global: readproc;
+  local: *;
+};
index 03c2a56244560a04784c874555bf9e52b1034e2b..06c6642fc93fa60985722f6a1c15c4084fda4236 100644 (file)
 #endif
 #endif
 
+// marks old junk, to warn non-procps library users
+#if ( __GNUC__ == 3 && __GNUC_MINOR__ > 0 ) || __GNUC__ > 3
+#define OBSOLETE __attribute__((deprecated))
+#else
+#define OBSOLETE
+#endif
+
+// available when?
+// Tells gcc that function is library-internal;
+// so no need to do dynamic linking at run-time.
+#if __GNUC__ > 2     // FIXME: total random guess that's sure to be wrong
+#define VISIBILITY_HIDDEN visibility("hidden")
+#else
+#define VISIBILITY_HIDDEN
+#endif
+// mark function for internal use
+#define HIDDEN __attribute__((VISIBILITY_HIDDEN))
+// given foo, create a foo_direct for internal use
+#define HIDDEN_ALIAS(x) extern __typeof(x) x##_direct __attribute__((alias(#x),VISIBILITY_HIDDEN))
+
 // since gcc-2.5
 #define NORETURN __attribute__((__noreturn__))
+#define FUNCTION __attribute__((__const__))  // no access to global mem, even via ptr, and no side effect
 
 #if __GNUC__ > 2 || __GNUC_MINOR__ >= 96
 // won't alias anything, and aligned enough for anything
 #define MALLOC __attribute__ ((__malloc__))
+// no side effect, may read globals
+#define PURE __attribute__ ((__pure__))
 // tell gcc what to expect:   if(unlikely(err)) die(err);
 #define likely(x)       __builtin_expect(!!(x),1)
 #define unlikely(x)     __builtin_expect(!!(x),0)
 #define expected(x,y)   __builtin_expect((x),(y))
 #else
 #define MALLOC
+#define PURE
 #define likely(x)       (x)
 #define unlikely(x)     (x)
 #define expected(x,y)   (x)
index 4811baba2dd8e0ca408fecc0636185144832c981..806b5a76c88f9d11f7a58b233d9c04157f9bd005 100644 (file)
@@ -576,6 +576,7 @@ void look_up_our_self(proc_t *p) {
     status2proc(sbuf, p);
 }
 
+HIDDEN_ALIAS(readproc);
 
 /* Convenient wrapper around openproc and readproc to slurp in the whole process
  * table subset satisfying the constraints of flags and the optional PID list.
@@ -607,7 +608,7 @@ proc_t** readproctab(int flags, ...) {
     va_end(ap);
     do {                                       /* read table: */
        tab = xrealloc(tab, (n+1)*sizeof(proc_t*));/* realloc as we go, using */
-       tab[n] = readproc(PT, NULL);              /* final null to terminate */
+       tab[n] = readproc_direct(PT, NULL);     /* final null to terminate */
     } while (tab[n++]);                                  /* stop when NULL reached */
     closeproc(PT);
     return tab;