Print this page
9696 add /etc/system.d support
Portions contributed by: Andy Fiddaman <andy@omniosce.org>
Reviewed by: Hans Rosenfeld <hans.rosenfeld@joyent.com>
Reviewed by: Peter Tribble <peter.tribble@gmail.com>
Reviewed by: C Fraire <cfraire@me.com>
Reviewed by: Toomas Soome <tsoome@me.com>


3334 modlookup_by_modctl(modctl_t *modp, const char *symname)
3335 {
3336         ASSERT(modp->mod_ref > 0 || modp->mod_busy);
3337 
3338         return (kobj_lookup(modp->mod_mp, symname));
3339 }
3340 
3341 /*
3342  * Ask the user for the name of the system file and the default path
3343  * for modules.
3344  */
3345 void
3346 mod_askparams()
3347 {
3348         static char s0[64];
3349         intptr_t fd;
3350 
3351         if ((fd = kobj_open(systemfile)) != -1L)
3352                 kobj_close(fd);
3353         else
3354                 systemfile = NULL;
3355 
3356         /*CONSTANTCONDITION*/
3357         while (1) {
3358                 printf("Name of system file [%s]:  ",
3359                     systemfile ? systemfile : "/dev/null");
3360 
3361                 console_gets(s0, sizeof (s0));
3362 
3363                 if (s0[0] == '\0')
3364                         break;
3365                 else if (strcmp(s0, "/dev/null") == 0) {
3366                         systemfile = NULL;
3367                         break;
3368                 } else {
3369                         if ((fd = kobj_open(s0)) != -1L) {
3370                                 kobj_close(fd);
3371                                 systemfile = s0;

3372                                 break;
3373                         }
3374                 }
3375                 printf("can't find file %s\n", s0);
3376         }
3377 }
3378 
3379 static char loading_msg[] = "loading '%s' id %d\n";
3380 static char load_msg[] = "load '%s' id %d loaded @ 0x%p/0x%p size %d/%d\n";
3381 
3382 /*
3383  * Common code for loading a module (but not installing it).
3384  * Handoff the task of module loading to a separate thread
3385  * with a large stack if possible, since this code may recurse a few times.
3386  * Return zero if there are no errors or an errno value.
3387  */
3388 static int
3389 mod_load(struct modctl *mp, int usepath)
3390 {
3391         int             retval;




3334 modlookup_by_modctl(modctl_t *modp, const char *symname)
3335 {
3336         ASSERT(modp->mod_ref > 0 || modp->mod_busy);
3337 
3338         return (kobj_lookup(modp->mod_mp, symname));
3339 }
3340 
3341 /*
3342  * Ask the user for the name of the system file and the default path
3343  * for modules.
3344  */
3345 void
3346 mod_askparams()
3347 {
3348         static char s0[64];
3349         intptr_t fd;
3350 
3351         if ((fd = kobj_open(systemfile)) != -1L)
3352                 kobj_close(fd);
3353         else
3354                 systemfile = self_assembly = NULL;
3355 
3356         /*CONSTANTCONDITION*/
3357         while (1) {
3358                 printf("Name of system file [%s]:  ",
3359                     systemfile ? systemfile : "/dev/null");
3360 
3361                 console_gets(s0, sizeof (s0));
3362 
3363                 if (s0[0] == '\0')
3364                         break;
3365                 else if (strcmp(s0, "/dev/null") == 0) {
3366                         systemfile = self_assembly = NULL;
3367                         break;
3368                 } else {
3369                         if ((fd = kobj_open(s0)) != -1L) {
3370                                 kobj_close(fd);
3371                                 systemfile = s0;
3372                                 self_assembly = NULL;
3373                                 break;
3374                         }
3375                 }
3376                 printf("can't find file %s\n", s0);
3377         }
3378 }
3379 
3380 static char loading_msg[] = "loading '%s' id %d\n";
3381 static char load_msg[] = "load '%s' id %d loaded @ 0x%p/0x%p size %d/%d\n";
3382 
3383 /*
3384  * Common code for loading a module (but not installing it).
3385  * Handoff the task of module loading to a separate thread
3386  * with a large stack if possible, since this code may recurse a few times.
3387  * Return zero if there are no errors or an errno value.
3388  */
3389 static int
3390 mod_load(struct modctl *mp, int usepath)
3391 {
3392         int             retval;