FreeNOS
utsname.cpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2009 Niek Linnenbank
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include <FreeNOS/Config.h>
19#include <string.h>
20#include "unistd.h"
21#include "sys/utsname.h"
22
23int uname(struct utsname *name)
24{
25 // Fill in the struct
26 strlcpy(name->sysname, "FreeNOS", UTSBUF);
28 strlcpy(name->release, RELEASE, UTSBUF);
29 strlcpy(name->version, COMPILER_VERSION " " DATETIME, UTSBUF);
30 strlcpy(name->machine, ARCH "/" SYSTEM, UTSBUF);
31
32 // Success
33 return 0;
34}
C int gethostname(char *name, size_t namelen)
Get name of current host.
C size_t strlcpy(char *dst, const char *src, size_t siz)
Copy src to string dst of size siz.
Definition strlcpy.cpp:19
#define UTSBUF
Size of each buffer in the utsname structure fields.
Definition utsname.h:33
int uname(struct utsname *name)
Get the name of the current system.
Definition utsname.cpp:23
System name structure.
Definition utsname.h:39
char release[UTSBUF]
Current release level of this implementation.
Definition utsname.h:50
char sysname[UTSBUF]
Name of this implementation of the operating system.
Definition utsname.h:41
char version[UTSBUF]
Current version level of this release.
Definition utsname.h:53
char machine[UTSBUF]
Name of the hardware type on which the system is running.
Definition utsname.h:56
char nodename[UTSBUF]
Name of this node within the communications network to which this node is attached,...
Definition utsname.h:47