Date: Thu, 18 Jan 2007 19:03:35 GMT From: Jung-uk Kim <jkim@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 113130 for review Message-ID: <200701181903.l0IJ3ZSu094383@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=113130 Change 113130 by jkim@jkim_hammer on 2007/01/18 19:02:51 - Use global 'version' instead of sysctl mib to construct build date. - Construct builder string from 'version' instead of fake one. Affected files ... .. //depot/projects/linuxolator/src/sys/compat/linprocfs/linprocfs.c#9 edit Differences ... ==== //depot/projects/linuxolator/src/sys/compat/linprocfs/linprocfs.c#9 (text+ko) ==== @@ -422,28 +422,44 @@ linprocfs_osbuild(struct thread *td, struct sbuf *sb) { char osbuild[256]; - int kern_ver[2]; - size_t size; char *cp1, *cp2; - cp1 = NULL; - kern_ver[0] = CTL_KERN; - kern_ver[1] = KERN_VERSION; - osbuild[0] = '\0'; - size = sizeof(osbuild); - if (kernel_sysctl(td, kern_ver, 2, &osbuild, &size, 0, 0, 0, 0) == 0) { - cp1 = strstr(osbuild, "\n"); - cp2 = strstr(osbuild, ":"); - if (cp1 && cp2) { - *cp1 = *cp2 = '\0'; - cp1 = strstr(osbuild, "#"); - } else - cp1 = NULL; - } + strncpy(osbuild, version, 256); + osbuild[255] = '\0'; + cp1 = strstr(osbuild, "\n"); + cp2 = strstr(osbuild, ":"); + if (cp1 && cp2) { + *cp1 = *cp2 = '\0'; + cp1 = strstr(osbuild, "#"); + } else + cp1 = NULL; if (cp1) sbuf_printf(sb, "%s%s", cp1, cp2 + 1); else - sbuf_printf(sb, "#4 Sun Dec 18 04:30:00 CET 1977"); + sbuf_cat(sb, "#4 Sun Dec 18 04:30:00 CET 1977"); +} + +/* + * Get OS builder + */ +static void +linprocfs_osbuilder(struct thread *td, struct sbuf *sb) +{ + char builder[256]; + char *cp; + + cp = strstr(version, "\n "); + if (cp) { + strncpy(builder, cp + 5, 256); + builder[255] = '\0'; + cp = strstr(builder, ":"); + if (cp) + *cp = '\0'; + } + if (cp) + sbuf_cat(sb, builder); + else + sbuf_cat(sb, "des@freebsd.org"); } /* @@ -457,8 +473,9 @@ linux_get_osname(td, osname); linux_get_osrelease(td, osrelease); - sbuf_printf(sb, "%s version %s (des@freebsd.org) (gcc version " - __VERSION__ ") ", osname, osrelease); + sbuf_printf(sb, "%s version %s (", osname, osrelease); + linprocfs_osbuilder(td, sb); + sbuf_cat(sb, ") (gcc version " __VERSION__ ") "); linprocfs_osbuild(td, sb); sbuf_cat(sb, "\n");
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200701181903.l0IJ3ZSu094383>