Submitted By: Csaba Henk (ekho@math-inst.hu) Date: 2003-10-27 Initial Package Version: 1.3.25 Origin: http://www.uclibc.org/lists/uclibc/2002-December/005167.html Description: This patch makes it possible to compile devfsd against uClibc. It is an attachment to the uclibc-bootfloppy hint. diff -Naur old/devfsd/devfsd.c devfsd/devfsd.c --- old/devfsd/devfsd.c 2002-03-25 06:59:40.000000000 +0000 +++ devfsd/devfsd.c 2003-10-27 08:31:37.000000000 +0000 @@ -1,3 +1,7 @@ +// This is a hacked version of devfsd.c. This hack makes it possible to +// compile devfsd against uClibc. This hack consists of commenting out +// some lines with "//". (There were no "//"-comments in the original.) + /* devfsd.c Main file for devfsd (devfs daemon for Linux). @@ -283,8 +287,8 @@ #include #include #include -#include -#include +//#include +//#include #include #include "devfsd.h" #include "version.h" @@ -486,9 +490,9 @@ {"fd/2", "stderr"}, {NULL, NULL}, }; -static int (*my_yp_all) (char *domain, char *map, - struct ypall_callback *callback); /* = NULL */ -static int (*my_yp_get_default_domain) (char **domainptr); /* = NULL */ +//static int (*my_yp_all) (char *domain, char *map, +// struct ypall_callback *callback); /* = NULL */ +//static int (*my_yp_get_default_domain) (char **domainptr); /* = NULL */ static struct event_type { unsigned int type; /* The DEVFSD_NOTIFY_* value */ @@ -714,29 +718,29 @@ [RETURNS] Nothing. */ { - if (location[0] == '+') - { - /* It's a YP map */ - struct ypall_callback ypall_cbk; - char *domainname = NULL; - - if (my_yp_all == NULL) load_libnsl (); - /* If no domain: fail silently (probably too early) */ - if ( (*my_yp_get_default_domain) (&domainname) != 0 ) return; - if (domainname == NULL) return; - ypall_cbk.foreach = ( int (*) () ) process_yp_line; - ypall_cbk.data = (char *) event_mask; - if ( (*my_yp_all) (domainname, (char *) location + 1,&ypall_cbk) == 0 ) - { - if (syslog_is_open) - SYSLOG (LOG_INFO, "read map: \"%s\"\n", location + 1); - return; - } - if (optional) return; - SYSLOG (LOG_ERR, "error reading map: \"%s\"\n", location + 1); - exit (1); - } - read_config_file (location, optional, event_mask); +// if (location[0] == '+') +// { +// /* It's a YP map */ +// struct ypall_callback ypall_cbk; +// char *domainname = NULL; +// +// if (my_yp_all == NULL) load_libnsl (); +// /* If no domain: fail silently (probably too early) */ +// if ( (*my_yp_get_default_domain) (&domainname) != 0 ) return; +// if (domainname == NULL) return; +// ypall_cbk.foreach = ( int (*) () ) process_yp_line; +// ypall_cbk.data = (char *) event_mask; +// if ( (*my_yp_all) (domainname, (char *) location + 1,&ypall_cbk) == 0 ) +// { +// if (syslog_is_open) +// SYSLOG (LOG_INFO, "read map: \"%s\"\n", location + 1); +// return; +// } +// if (optional) return; +// SYSLOG (LOG_ERR, "error reading map: \"%s\"\n", location + 1); +// exit (1); +// } +// read_config_file (location, optional, event_mask); } /* End Function read_config */ static void read_config_file (CONST char *path, flag optional, @@ -1008,30 +1012,30 @@ static void load_libnsl (void) { -#ifdef LIBNSL /* It comes from a shared object */ - void *libnsl_handle; - - libnsl_handle = dlopen (LIBNSL, RTLD_LAZY); - if (libnsl_handle == NULL) - { - SYSLOG ( LOG_ERR, "read map: unable to open %s: %s", - LIBNSL, dlerror() ); - exit (1); - } - my_yp_all = dlsym_nofail (LIBNSL, libnsl_handle, "yp_all"); - my_yp_get_default_domain = - dlsym_nofail (LIBNSL, libnsl_handle, "yp_get_default_domain"); -#else /* It's built-in the C library */ - my_yp_all = yp_all; - my_yp_get_default_domain = yp_get_default_domain; -#endif +//#ifdef LIBNSL /* It comes from a shared object */ +// void *libnsl_handle; +// +// libnsl_handle = dlopen (LIBNSL, RTLD_LAZY); +// if (libnsl_handle == NULL) +// { +// SYSLOG ( LOG_ERR, "read map: unable to open %s: %s", +// LIBNSL, dlerror() ); +// exit (1); +// } +// my_yp_all = dlsym_nofail (LIBNSL, libnsl_handle, "yp_all"); +// my_yp_get_default_domain = +// dlsym_nofail (LIBNSL, libnsl_handle, "yp_get_default_domain"); +//#else /* It's built-in the C library */ +// my_yp_all = yp_all; +// my_yp_get_default_domain = yp_get_default_domain; +//#endif } /* End Function load_libnsl */ static int process_yp_line (int instatus, char *inkey, int inkeylen, char *inval, int invallen, char *indata) { - if (instatus != YP_TRUE) return (instatus); - if (invallen > 0) process_config_line (inval, (unsigned long *) indata); +// if (instatus != YP_TRUE) return (instatus); +// if (invallen > 0) process_config_line (inval, (unsigned long *) indata); return (0); } /* End Function process_yp_line */