OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

111 lines
3.6 KiB

  1. # --- T2-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # T2 SDE: package/.../devfsd/linux-2.6.patch
  5. # Copyright (C) 2004 - 2006 The T2 SDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This patch file is dual-licensed. It is available under the license the
  10. # patched project is licensed under, as long as it is an OpenSource license
  11. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  12. # of the GNU General Public License as published by the Free Software
  13. # Foundation; either version 2 of the License, or (at your option) any later
  14. # version.
  15. # --- T2-COPYRIGHT-NOTE-END ---
  16. --- devfsd/check_kernel.c.kernel25 2003-06-02 22:17:21.000000000 +0400
  17. +++ devfsd/check_kernel.c 2003-06-02 22:17:43.000000000 +0400
  18. @@ -0,0 +1,30 @@
  19. +#include <sys/types.h>
  20. +#include <stdio.h>
  21. +#include <unistd.h>
  22. +#include <errno.h>
  23. +#include <asm/unistd.h>
  24. +
  25. +extern char *modules_devfs;
  26. +
  27. +/* copied over from module-init-tools backward_compat.c */
  28. +#ifndef __ia64 /* breaks ia64. */
  29. +static _syscall2(long, create_module, const char *, name, size_t, size);
  30. +#else
  31. +#define create_module(name, size) \
  32. + syscall(__NR_create_module, (name), (size))
  33. +#endif
  34. +
  35. +void check_kernel_version (int verbose)
  36. +{
  37. + int k26 = 1;
  38. +
  39. + errno = 0;
  40. + if (create_module(NULL, 0) >= 0 | errno != ENOSYS) {
  41. + modules_devfs = "/etc/modules.devfs";
  42. + k26 = 0;
  43. + }
  44. +
  45. + if (verbose)
  46. + fprintf (stderr, "devfsd: kernel %s detected, using %s for MODLOAD\n",
  47. + k26 ? "2.6" : "2.4", modules_devfs);
  48. +}
  49. --- devfsd/devfsd.c.kernel25 2003-06-02 22:17:21.000000000 +0400
  50. +++ devfsd/devfsd.c 2003-06-02 22:17:21.000000000 +0400
  51. @@ -396,10 +396,14 @@ EXTERN_FUNCTION (flag st_expr_expand,
  52. EXTERN_FUNCTION (const char *get_old_name,
  53. (const char *devname, unsigned int namelen,
  54. char *buffer, unsigned int major, unsigned int minor) );
  55. -
  56. +EXTERN_FUNCTION (void check_kernel_version,
  57. + (int) );
  58. /* Public data */
  59. flag syslog_is_open = FALSE;
  60. +/* set to new style, runtime test might override it later */
  61. +char *modules_devfs = "/etc/modprobe.devfs";
  62. +
  63. /* Public functions */
  64. @@ -508,7 +512,6 @@ static struct event_type
  65. {0xffffffff, NULL, NULL}
  66. };
  67. -
  68. /* Public functions follow */
  69. int main (int argc, char **argv)
  70. @@ -652,6 +655,7 @@ int main (int argc, char **argv)
  71. /* Set umask so that mknod(2), open(2) and mkdir(2) have complete control
  72. over permissions */
  73. umask (0);
  74. + check_kernel_version (trace_level);
  75. read_config (CONFIG_FILE, FALSE, &event_mask);
  76. /* Do the scan before forking, so that boot scripts see the finished
  77. product */
  78. @@ -1243,7 +1247,7 @@ static void action_modload (const struct
  79. argv[0] = "/sbin/modprobe";
  80. argv[1] = "-k";
  81. argv[2] = "-C";
  82. - argv[3] = "/etc/modules.devfs";
  83. + argv[3] = modules_devfs;
  84. argv[4] = device;
  85. argv[5] = NULL;
  86. snprintf (device, sizeof (device), "/dev/%s", info->devname);
  87. --- devfsd/GNUmakefile.kernel25 2002-02-19 09:06:43.000000000 +0300
  88. +++ devfsd/GNUmakefile 2003-06-02 22:17:21.000000000 +0400
  89. @@ -18,13 +18,16 @@ endif
  90. all: devfsd rpm.spec
  91. -OBJECTS = devfsd.o expression.o compat_name.o
  92. +OBJECTS = devfsd.o expression.o compat_name.o check_kernel.o
  93. CFLAGS = -O2 -I. -I$(KERNEL_DIR)/include -Wall $(CEXTRAS) $(DEFINES)
  94. devfsd: $(OBJECTS)
  95. $(CC) -O2 -o devfsd $(OBJECTS) $(LDFLAGS) -export-dynamic -ldl
  96. +check_kernel.o: check_kernel.c
  97. + $(CC) -O2 -c $<
  98. +
  99. install: devfsd
  100. @if fgrep -q "Generic section: do not change" /etc/modules.conf ; then\
  101. echo "First remove the generic devfs entries from /etc/modules.conf"; exit 1; \