uname

C how to use the function uname

*爱你&永不变心* 提交于 2021-02-06 08:46:52
问题 I should write a function to get some information about the system (the most important information is the the architecture). I found the function uname which can be used including sys/utsname.h . Well, though I googled and I read the documentation, I couldn't find any example of the function and I don't understand how to use uname. Anyone can explain me how to use it? it would be great if you can write an example, too. Thanks in advance. 回答1: First, include the header: #include <sys/utsname.h

linux中uname命令参数及用法详解

有些话、适合烂在心里 提交于 2020-02-29 02:44:58
uname 命令可用于大多数 UNIX 和类 UNIX 系统以及 Linux。 功能说明:uname用来获取电脑和操作系统的相关信息。 语  法:uname [-amnrsvpio][--help][--version] 补充说明:uname可显示linux主机所用的操作系统的版本、硬件的名称等基本信息。 参  数: -a或–all 详细输出所有信息,依次为内核名称,主机名,内核版本号,内核版本,硬件名,处理器类型,硬件平台类型,操作系统名称 -m或–machine 显示主机的硬件(CPU)名 -n或-nodename 显示主机在网络节点上的名称或主机名称 -r或–release 显示linux操作系统内核版本号 -s或–sysname 显示linux内核名称 -v 显示显示操作系统是第几个 version 版本 -p 显示处理器类型或unknown -i 显示硬件平台类型或unknown -o 显示操作系统名 –help 获得帮助信息 –version   显示uname版本信息 最常用参数 uname -a 几个使用示例(资料来自linuxso.com): [root@linuxso.com ~]# uname Linux 注:单独使用uname命令时相当于uname -s [root@linuxso.com ~]# uname -a Linux linuxso.com 2.6

How to change version string of the kernel?

百般思念 提交于 2020-01-21 04:30:33
问题 I'm very new to Linux and very new to building/compiling my own kernel. For starters, I'm just trying to figure out how to change the version string of my kernel. For instance, when I do uname -a, it prints out "Linux localhost.localdomain 3.11.10-100.fc18.i686". I'd like to customize that, but I'm not sure what file to edit. I know it must be some file in my kernel directory, but I've been going through them with no luck. Any help would be great! 回答1: At the top of the top-level Makefile,

Accurately determine the type of OS PHP is running on

北城以北 提交于 2019-12-21 20:17:41
问题 I need to determine the type of OS the PHP server is running on. By type, I mean strings like "windows" or "linux", not "wince", "winnt" etc. So far, I have to leads: PHP_OS and uname(), the later being more reliable than the earlier (PHP_OS says what OS PHP was built on - according to documentation). 回答1: It's important to know that no non-Windows OS string is going to contain the text "win", and no non-OSX OS string is going to contain the word "darwin", and so on. Detecting the OS is easy.

How to strip trailing whitespace in CMake variable?

谁说我不能喝 提交于 2019-12-17 18:56:08
问题 We are trying to improve the makefiles produced by CMake. For Clang, GCC and ICC, we want to add -march=native . The block to do so looks like: # -march=native for GCC, Clang and ICC on i386, i486, i586, i686 and x86_64. message(STATUS, "1") message(STATUS, "Compiler: x${CMAKE_CXX_COMPILER_ID}x") if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") message(STATUS, "2") message(STATUS, "Machine: x${UNAME

Verify the version of ubuntu running in a Docker container

别等时光非礼了梦想. 提交于 2019-12-13 12:24:45
问题 I have Docker Toolbox installed on windows 8.1 and I am creating an image based on ubuntu:latest (which should be 16.04). I want to make sure that my application is indeed run on 16.04. Here is my Dockerfile: FROM ubuntu:latest MAINTAINER xyz xyz@abc.com COPY apt.conf /etc/apt/ RUN apt-get -y update RUN apt-get -y install cmake RUN mkdir /usr/local/ COPY folder /usr/local/ RUN mkdir /usr/local/build CMD cd /usr/local/build CMD cmake /usr/local/ Once the image is built, i try to run : docker

How to modify the Linux kernel to change the version string that uname returns?

随声附和 提交于 2019-12-08 02:41:53
问题 I'm working with an old (2.6.33.2) version of embedded Linux and have been asked to change the kernel so that differently patched kernel images can be told apart. At the moment, uname -v outputs e.g. "#1 Wed Sep 11 07:07:51 BST 2013 . Hence I'd like to change this so that any subsequent patches change the #1 part to a revision number defined as part of the patch (and to change the date part to be the date of the latest kernel patch), but I can't see where in the kernel this is set up. What

What does YOUR uname say?

眉间皱痕 提交于 2019-12-07 03:59:13
问题 Short story: I need to write a PHP script which finds the correct OS type from uname (eg: both wince and winnt would return windows ). See here for more info. Shouldn't this be a community wiki? Yes but...see here. How to help: If your OS is not listed below, please run this code and share your findings: <?php echo php_uname(); ?> Or, in a Unix shell, try user@host ~ > php -a php > echo php_uname(); List of shared results Darwin ... 10.4.0 Darwin Kernel Version 10.4.0: Fri Apr 23 18:28:53 PDT

What does YOUR uname say?

房东的猫 提交于 2019-12-05 06:12:16
Short story: I need to write a PHP script which finds the correct OS type from uname (eg: both wince and winnt would return windows ). See here for more info. Shouldn't this be a community wiki? Yes but... see here . How to help: If your OS is not listed below, please run this code and share your findings: <?php echo php_uname(); ?> Or, in a Unix shell, try user@host ~ > php -a php > echo php_uname(); List of shared results Darwin ... 10.4.0 Darwin Kernel Version 10.4.0: Fri Apr 23 18:28:53 PDT 2010; root:xnu-1504.7.4~1/RELEASE_I386 i386 Darwin ... 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15

Accurately determine the type of OS PHP is running on

浪子不回头ぞ 提交于 2019-12-04 11:46:00
I need to determine the type of OS the PHP server is running on. By type, I mean strings like "windows" or "linux", not "wince", "winnt" etc. So far, I have to leads: PHP_OS and uname(), the later being more reliable than the earlier (PHP_OS says what OS PHP was built on - according to documentation). mellowsoon It's important to know that no non-Windows OS string is going to contain the text "win", and no non-OSX OS string is going to contain the word "darwin", and so on. Detecting the OS is easy. $uname = strtolower(php_uname()); if (strpos($uname, "darwin") !== false) { // It's OSX } else