rpms/udev/devel modprobe_helper.c,NONE,1.1 modprobe,1.3,NONE

Harald Hoyer (harald) fedora-extras-commits at redhat.com
Mon Jul 9 15:46:50 UTC 2007


Author: harald

Update of /cvs/pkgs/rpms/udev/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv24503

Added Files:
	modprobe_helper.c 
Removed Files:
	modprobe 
Log Message:
some speedups


--- NEW FILE modprobe_helper.c ---
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

#define PNP_STR "pnp:d"

extern char **environ;

int main(int argc, char **argv)
{
  int fd = 0;
  int len, i;

  if (getenv("MODPROBE_DEBUG")) {
    int confd = open("/dev/console", O_RDWR);
    if (confd >= 0) {
      dup2(confd, 0);
      dup2(confd, 1);
      dup2(confd, 2);
      close(confd);
    }

    fprintf(stderr, "modprobe ");
    for (i=1; i < argc; i++)
      fprintf(stderr, "%s ", argv[1]);
    fprintf(stderr, "\n");
  }

  if (! getenv("MODPROBE_COLLECT")) 
    goto fallback;

  if ( argc != 2 )
    goto fallback;

  fd = open("/dev/MODPROBE", O_CREAT|O_WRONLY|O_APPEND);

  if (fd < 0) 
    goto fallback;

  len = strlen(argv[1]);
    
  if ((write(fd, argv[1], len) != len) || (write(fd, "\n", 1) != 1)) {
    close(fd);
    goto fallback;
  }
  close(fd);
  exit(0);

 fallback:
  execve ("/sbin/modprobe", argv, environ);

}


--- modprobe DELETED ---




More information about the fedora-extras-commits mailing list