+#if 1 /* Linux */
+
+ const struct file *filp;
+
+ if (insn->o.opcode == O_JAIL)
+ return 0;
+
+ if (skb->sk == NULL || skb->sk->sk_socket == NULL)
+ return 0;
+
+ filp = skb->sk->sk_socket->file;
+ if (filp == NULL)
+ return 0;
+
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,28)
+/* use the current's real uid/gid */
+#define UID f_uid
+#define GID f_gid
+#else /* 2.6.29 */
+/* use the current's file access real uid/gid */
+#define UID f_cred->fsuid
+#define GID f_cred->fsgid
+#endif
+
+ if (insn->o.opcode == O_UID) {
+ if (filp->UID != (uid_t)insn->d[0])
+ return 0;
+ }
+
+ if (insn->o.opcode == O_GID) {
+ if (filp->GID != (gid_t)insn->d[0])
+ return 0;
+ }
+
+ return 1;
+
+#else /* FreeBSD original code */