Sponsored Content
Operating Systems BSD Declaring Global Variables in KLD Post 302159954 by int80h on Saturday 19th of January 2008 01:28:28 PM
Old 01-19-2008
Declaring Global Variables in KLD

Hello,
how can I define a global variables in KLD?
I would like to define some variables in my KLD and then would like to use them from other KLD.

Thanx
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

perl global variables

Can someone give me "the lecture" on why you shouldn't make all your varables global when programming in perl. I have been doing this but I have heard that it is not a good practice. (3 Replies)
Discussion started by: reggiej
3 Replies

2. Programming

global variables in KLD (FreeBSD)

Hello dear BSD hackers, how can I define and then make visible some variables that I define in KLD (BSD) for other part of Kernel or other KLD's ? if i declare for example the varibale out of load-function of KLD , the name of this variable isn't export to symbol-table and the variable can... (0 Replies)
Discussion started by: int80h
0 Replies

3. Shell Programming and Scripting

Problem with global and local variables

Guys, how can I define global variables in sorlaris...cause I lose the values outside the scope. Rite now wat I do is,I redirect variable value to a file n then get it back outside the function...:o....theres obviously a better way of doing this...I now this is a basic question....but please... (2 Replies)
Discussion started by: qzv2jm
2 Replies

4. UNIX for Dummies Questions & Answers

global variables

Hi, I hav created a script that calls a sub-script. In both the scripts i called the configuration file. Now i wanted to use a variable that should be used in both script and sub-script files. Actually, i wanted to return a file name and the return status to the script file from the sub-script.... (6 Replies)
Discussion started by: Swapna173
6 Replies

5. Programming

global variables and dynamic allocation

Hi, is it possible in C to allocate dynamically a global variable?? (3 Replies)
Discussion started by: littleboyblu
3 Replies

6. Programming

Declaring variables

Hey guys im facing a problem in declaring variables. i have a few classes like the one below... #ifndef _FINANCE_H #define _FINANCE_H #include <string> #include <iostream> #include <fstream> #include <stdlib.h> using namespace std ; class readStraitsTimesIndex { ... (3 Replies)
Discussion started by: gregarion
3 Replies

7. Solaris

How to access ENV variables of non global zones in global zone???

Hi Guys, My requirement is I have file called /opt/orahome/.profile in non global zone. PATH=/usr/bin:/usr/ucb:/etc:/usr/sbin:/usr/local/bin:/usr/openwin/bin:. export PATH PS1="\${ORACLE_SID}:`hostname`:\$PWD$ " export PS1 EDITOR=vi export EDITOR ENV=/opt/orahome/.kshrc export ENV... (1 Reply)
Discussion started by: vijaysachin
1 Replies

8. Shell Programming and Scripting

Find global variables, c source

Hello.I have been trying to solve the following problem, but to no avail. If anyone could please give me some indications, or anything, it would be amazing. A C source program and a type name are given. Determine from source, the list of the global variables having the given type. For each... (5 Replies)
Discussion started by: Susan78
5 Replies

9. Shell Programming and Scripting

Declaring variables without initialization

I get an error in my shell script that line 1: )unexpected. Line 1 in my script (using sh by the way) is the variable I declared but did not initialize it. result= Is this wrong? How can I fix it? I am using the variable later in the program, so I figured I could just declare it first... (4 Replies)
Discussion started by: itech4814
4 Replies

10. UNIX for Dummies Questions & Answers

Global variables in perl

hi all, i need a help for the following query. Thanks in advance for your valuable time. i have a main.pl file which has a global variable declared as below. our myVar=0; call first.pl script from the main.pl script. print the value of myVar (the value is still 0 and not 10.) i have a... (1 Reply)
Discussion started by: hemalathak10
1 Replies
NG_ETHER(4)						   BSD Kernel Interfaces Manual 					       NG_ETHER(4)

NAME
ng_ether -- Ethernet netgraph node type SYNOPSIS
#include <netgraph/ng_ether.h> DESCRIPTION
The ether netgraph node type allows Ethernet interfaces to interact with the netgraph(4) networking subsystem. Once the ng_ether module is loaded into the kernel, a node is automatically created for each Ethernet interface in the system. Each node will attempt to name itself with the same name as the associated interface. Three hooks are supported: lower, upper, and orphans. The hook name divert may be used as an alias for lower, and is provided for backward compatibility. In reality, the two names represent the same hook. The lower hook is a connection to the raw Ethernet device. When connected, all incoming packets are forwarded to this hook, instead of being passed to the kernel for upper layer processing. Writing to this hook results in a raw Ethernet frame being transmitted by the device. Nor- mal outgoing packets are not affected by lower being connected. The upper hook is a connection to the upper protocol layers. When connected, all outgoing packets are forwarded to this hook, instead of being transmitted by the device. Writing to this hook results in a raw Ethernet frame being received by the kernel just as if it had come in over the wire. Normal incoming packets are not affected by upper being connected. The orphans hook is equivalent to lower, except that only unrecognized packets (that would otherwise be discarded) are written to the hook, while other normal incoming traffic is unaffected. Unrecognized packets written to upper will be forwarded back out to orphans if connected. In all cases, frames are raw Ethernet frames with the standard 14 byte Ethernet header (but no checksum). When no hooks are connected, upper and lower are in effect connected together, so that packets flow normally upwards and downwards. HOOKS
This node type supports the following hooks: lower Connection to the lower device link layer. upper Connection to the upper protocol layers. orphans Like lower, but only receives unrecognized packets. CONTROL MESSAGES
This node type supports the generic control messages, plus the following: NGM_ETHER_GET_IFNAME (getifname) Returns the name of the associated interface as a NUL-terminated ASCII string. Normally this is the same as the name of the node. NGM_ETHER_GET_IFINDEX (getifindex) Returns the global index of the associated interface as a 32 bit integer. NGM_ETHER_GET_ENADDR (getenaddr) Returns the device's unique six byte Ethernet address. NGM_ETHER_SET_ENADDR (setenaddr) Sets the device's unique six byte Ethernet address. This control message is equivalent to using the SIOCSIFLLADDR ioctl(2) system call. NGM_ETHER_SET_PROMISC (setpromisc) Enable or disable promiscuous mode. This message includes a single 32 bit integer flag that enables or disables promiscuous mode on the interface. Any non-zero value enables promiscuous mode. NGM_ETHER_GET_PROMISC (getpromisc) Get the current value of the node's promiscuous flag. The returned value is always either one or zero. Note that this flag reflects the node's own promiscuous setting and does not necessarily reflect the promiscuous state of the actual interface, which can be affected by other means (e.g., bpf(4)). NGM_ETHER_SET_AUTOSRC (setautosrc) Sets the automatic source address override flag. This message includes a single 32 bit integer flag that causes all outgoing packets to have their source Ethernet address field overwritten with the device's unique Ethernet address. If this flag is set to zero, the source address in outgoing packets is not modified. The default setting for this flag is disabled. NGM_ETHER_GET_AUTOSRC (getautosrc) Get the current value of the node's source address override flag. The returned value is always either one or zero. NGM_ETHER_ADD_MULTI (addmulti) Join Ethernet multicast group. This control message is equivalent to using the SIOCADDMULTI ioctl(2) system call. NGM_ETHER_DEL_MULTI (delmulti) Leave Ethernet multicast group. This control message is equivalent to using the SIOCDELMULTI ioctl(2) system call. NGM_ETHER_DETACH (detach) Detach from underlying Ethernet interface and shut down node. SHUTDOWN
Upon receipt of the NGM_SHUTDOWN control message, all hooks are disconnected, promiscuous mode is disabled, and the source address override flag is re-enabled, but the node is not removed. Node can be shut down only using NGM_ETHER_DETACH control message. If the interface itself is detached (e.g., because of PC Card removal), the node disappears as well. EXAMPLES
This command dumps all unrecognized packets received by the ``fxp0'' interface to standard output decoded in hex and ASCII: nghook -a fxp0: orphans This command sends the contents of sample.pkt out the interface ``fxp0'': cat sample.pkt | nghook fxp0: orphans These commands insert an ng_tee(4) node between the lower and upper protocol layers, which can be used for tracing packet flow, statistics, etc.: ngctl mkpeer fxp0: tee lower right ngctl connect fxp0: lower upper left SEE ALSO
arp(4), netgraph(4), netintro(4), ifconfig(8), ngctl(8), nghook(8) AUTHORS
Julian Elischer <julian@FreeBSD.org> Archie Cobbs <archie@FreeBSD.org> BUGS
The automatic KLD module loading mechanism that works for most other Netgraph node types does not work for the ether node type, because ether nodes are not created on demand; instead, they are created when Ethernet interfaces are attached or when the KLD is first loaded. Therefore, if the KLD is not statically compiled into the kernel, it is necessary to load the KLD manually in order to bring the ether nodes into exis- tence. BSD
August 4, 2006 BSD
All times are GMT -4. The time now is 10:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy