< prev index next >

src/java.base/unix/native/libjava/java_props_md.c

Print this page


   1 /*
   2  * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 440         struct utsname name;
 441         uname(&name);
 442         sprops.os_name = strdup(name.sysname);
 443 #ifdef _AIX
 444         {
 445             char *os_version = malloc(strlen(name.version) +
 446                                       strlen(name.release) + 2);
 447             if (os_version != NULL) {
 448                 strcpy(os_version, name.version);
 449                 strcat(os_version, ".");
 450                 strcat(os_version, name.release);
 451             }
 452             sprops.os_version = os_version;
 453         }
 454 #else
 455         sprops.os_version = strdup(name.release);
 456 #endif /* _AIX   */
 457 #endif /* MACOSX */
 458 
 459         sprops.os_arch = ARCHPROPNAME;

 460 
 461         if (getenv("GNOME_DESKTOP_SESSION_ID") != NULL) {

 462             sprops.desktop = "gnome";
 463         }
 464         else {
 465             sprops.desktop = NULL;
 466         }
 467     }
 468 
 469     /* ABI property (optional) */
 470 #ifdef JDK_ARCH_ABI_PROP_NAME
 471     sprops.sun_arch_abi = JDK_ARCH_ABI_PROP_NAME;
 472 #endif
 473 
 474     /* Determine the language, country, variant, and encoding from the host,
 475      * and store these in the user.language, user.country, user.variant and
 476      * file.encoding system properties. */
 477     setlocale(LC_ALL, "");
 478     if (ParseLocale(env, LC_CTYPE,
 479                     &(sprops.format_language),
 480                     &(sprops.format_script),
 481                     &(sprops.format_country),


   1 /*
   2  * Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 440         struct utsname name;
 441         uname(&name);
 442         sprops.os_name = strdup(name.sysname);
 443 #ifdef _AIX
 444         {
 445             char *os_version = malloc(strlen(name.version) +
 446                                       strlen(name.release) + 2);
 447             if (os_version != NULL) {
 448                 strcpy(os_version, name.version);
 449                 strcat(os_version, ".");
 450                 strcat(os_version, name.release);
 451             }
 452             sprops.os_version = os_version;
 453         }
 454 #else
 455         sprops.os_version = strdup(name.release);
 456 #endif /* _AIX   */
 457 #endif /* MACOSX */
 458 
 459         sprops.os_arch = ARCHPROPNAME;
 460         char* curr_desktop = getenv("XDG_CURRENT_DESKTOP");
 461 
 462         if (getenv("GNOME_DESKTOP_SESSION_ID") != NULL
 463             || (curr_desktop != NULL && strcasestr(curr_desktop, "gnome") != NULL)) {
 464             sprops.desktop = "gnome";
 465         }
 466         else {
 467             sprops.desktop = NULL;
 468         }
 469     }
 470 
 471     /* ABI property (optional) */
 472 #ifdef JDK_ARCH_ABI_PROP_NAME
 473     sprops.sun_arch_abi = JDK_ARCH_ABI_PROP_NAME;
 474 #endif
 475 
 476     /* Determine the language, country, variant, and encoding from the host,
 477      * and store these in the user.language, user.country, user.variant and
 478      * file.encoding system properties. */
 479     setlocale(LC_ALL, "");
 480     if (ParseLocale(env, LC_CTYPE,
 481                     &(sprops.format_language),
 482                     &(sprops.format_script),
 483                     &(sprops.format_country),


< prev index next >