Programming :: Convert Macro Defined Functions From Kernel In Visual C++?

Jun 27, 2009

I am dealing with some Linux kernel code, which define most its functions with Macros.The trouble I am having is to use those code in user space in Windows.

For example, I have a function defined like this:

#define list_for_each_entry_safe(pos, n, head, member)
for (pos = list_entry((head)->next, typeid(*pos), member),
n = list_entry(pos->member.next, typeid(*pos), member);
&pos->member != (head);
pos = n, n = list_entry(n->member.next, typeid(*n), member))

And in user space code, I call it in this way:

list_for_each_entry_safe( pcre_item, tmp,
&(((pcre_list_head_t *)(hr.value))->head), list)
{
// My code to handle each element in the list
}

This is working like a charm in Linux, but I got errors in Windows:

It reminds me missing ';' after 'list_for_each_entry_safe( pcre_item, tmp,
&(((pcre_list_head_t *)(hr.value))->head), list)'.

Does this kind of linux code not working in Windows at all? (Linux is in GCC C stand and VC is ANSI C) I prefer not to convert them to normal functions but keep it the way if it could be working under windows by some tricks.

View 5 Replies


ADVERTISEMENT

Programming :: C++: Macro Not Defined In Quotes?

Dec 12, 2009

I converted my programming project over to autotools, which gives me a config.h file with all the cool definitions, like these ones:

Code:

/* Location of data files. */
#define DATADIR "/usr/local/share"
/* Define to the full name of this package. */
#define PACKAGE_NAME "lusus"

And naturally I think this is cool because then I can hardcore these into the binary. To my dismay, however, I discovered that the pre-processor does not do the text-substitution if the macro name is inside another quoted string.

Code:

// Prints out "/usr/local/share/lusus"
std::cout << DATADIR << "/" << PACKAGE_NAME << "
";

[code]....

This seems lame, because then this doesn't work:

Code:

CL_Image leaves_corner_tl(gc, "DATADIR/PACKAGE_NAME/img/leaves_corner_tl.png");

So, am I literally going to have to strcat DATADIR/PACKAGE with the other text every time I want to prefix DATADIR/PACKAGE_NAME onto another string?

View 2 Replies View Related

Programming :: How To Test Whether A Macro Is Defined

Mar 20, 2011

I've been reviewing some source code recently which contains many conditional compilation statements, and I found it hard to understand the code not knowing whether some macro is defined or not. Is there any way to test whether a macro is defined?

View 2 Replies View Related

Programming :: Macro To Access Kernel Objectys Structure?

Jan 29, 2011

telling the exact macro name and location, by which I can gain control over the following kernel base level structure

1. strct super_block of Virtual File System, for super block object.
2. strct inode for inode ofject of VFS.
3 file structure for file object of VFS.

in addition to these if you know location to access other kernel structure.Please let me know.My main objective is to get the access to the structure pointer of these structure by which i can have access over the individual fields o these structure.

View 11 Replies View Related

Programming :: Calling Kernel Functions From Userspace?

Feb 5, 2010

I'm trying to call some kernel functions from userspace, but I'm not sure if I'm doing it right. The functions control a pulse width modulator on an embedded platform. To pick one at random, the function:

Code:
struct pwm_device *pwm_request(int pwm_id, const char *label);
is defined in linux/pwm.h, and the implementation uses the macro EXPORT_SYMBOL(pwm_request), so I should be able to call this from user-space... right?

Anyway, I've got linux/pwm.h to #include in my source so the compiler knows what it's doing, but what do I link against? The only place in by kernel build tree where I can see a symbol pwm_request defined is in object files like vmlinux.o, built-in.o in the directory, etc. which I don't think I should be linking against.

View 2 Replies View Related

Programming :: How To Find Man Page Of Kernel Functions

Aug 2, 2010

My distribution is Fedora 12. When I want to get the infos of kernel functions such as printk, i type man printk, failed. I look up some articles and learn that in some distributions the kernel functions is in section 9 of man page. Then i type man 9 printk also no reply. How can i get man pages of kernel functions ?

View 2 Replies View Related

Programming :: How To Edit Kernel Source Code In MS Visual Studio

Apr 27, 2010

I want to edit linux kernel source code in MS Visual Studio. I saw the code and these are c files but there is no project file that i open it and whole project opens up. I can open each individual file but not the whole project.

View 13 Replies View Related

Programming :: Define Functions Within Other Functions In C++?

Mar 11, 2010

Is it possible to define functions within other functions in C++? I know it is the case in other languages.

View 2 Replies View Related

General :: Kernel Programming - Convert Timespec To Datetime

Dec 29, 2010

I'm changing some syscalls functions into kernel 2.6.36.2

So i'm doing this :

Code:

But i have a output like this : Date 1293619251

How can i convert inode->i_atime into D:M:Y h:m Format?? or just simply D:M:Y

View 1 Replies View Related

Programming :: Append Item To A List ( C Macro )?

Apr 13, 2010

I have my own declared types and I have to operate with lists of items. I wish to write a one macro, instead of using a function for each type. It's intended to be like this: Code: #define ____append_to_list(head,

item, type)
type* ptr;
for ( ptr = head; ptr->next != NULL; ptr = ptr->next )

[code].....

View 9 Replies View Related

Programming :: Can't Get VBA Macro To Run In Powerpoint Slide Show

Aug 18, 2010

All I'm trying to do is ShellExecute a program every time a new slide appears.

I'm using Office 2003 Powerpoint.

I did the following:

1. Tools, Options, Security Options, Macro Security, Security Level= Medium

2. Tools, Options, Macro, VBA Editor:

Code:
Sub OnSlideShowPageChange(ByVal SSW As SlideShowWindow)
MsgBox ("OnSlideShowPageChange")
End Sub

3. File, Save

4. Back to PowerPoint: F5) Slide Show, View Show <= Did NOT see the message box

5. Exit out of Powerpoint, reopen the .ppt file, F5) again <= Still don't see the message box

why isn't "OnSlideShowPageChange" getting invoked when I run the slide show?

View 3 Replies View Related

Programming :: Integrate A MACRO Command In Open Office?

Dec 3, 2010

integrate a macro from MS Word to Open Office? It is a script I need for music. I cannot upload the file here nor give you the link, because I'm not let.

View 9 Replies View Related

Programming :: Macro To Get Base Address Register In Configuration Space?

Nov 21, 2010

I am trying to understand working of pci_resource_start function So I browsed code via cscope and searched for string pci_resource_start and got following in pci.h

Code:

#define pci_resource_start(dev, bar) ((dev)->resource[(bar)].start)

I am not able to understand how does this above macro works. How does it above macro gets appropriate base address register in configuration space?

View 1 Replies View Related

Programming :: C++ Programming With Simple RTAI Functions Outputing Words?

Apr 11, 2011

I need help as I am not proficient with Linux C++ Programming. There are two parts which I need to do in the coding provided below.

1. Produce the program so it can output the word "Hey there!" and wait two minute and print the word "See you later!".

2. Produce the program that will output the text "Cool" every 20 seconds by setting a periodic task.

Quote:
#include <linux/kernel.h>
#include <linux/module.h>
MODULE_LICENSE("GPL");
int init_module(void)
{
printk("Hey there!

[Code]...

View 3 Replies View Related

Ubuntu :: No Installable Kernel Was Found In The Defined APT Source?

Aug 11, 2010

I am trying to install ubuntu on an old machine and no matter what version I try to install I get this same error.

"No installable Kernel was found in the defined APT sources"

The versions I have tried are (9.04server. 9.10desktop, 10.04 server).

I have swapped both the CD drive and HDD drive becuase, well i don't know why, but I have. This didn't work.

I have read [URL] and have tried changing my BIOS settings so that i have my config is:

IDE Primary Master : Maxtor 6Y080L0 (HDD)
IDE Primary Slave : HL-dt-st-sl8480b (CD-DRIVE)

This didn't work.

I have also tried doing the instructions posted by migraineman on the second page of the thread mentioned above but this also didn't work.

My specs are:

Cyrix 6x86 Processor
80Gb Maxtor HDD
LG-GCE CD-ROM Drive
319Mb RAM - 8Mb Shared

View 4 Replies View Related

General :: Difference And Working Functions Between Kernel And Shell

Apr 4, 2011

I am the new child of the linux world. What is the difference and working functions between kernel and shell..

View 5 Replies View Related

Debian Installation :: No Installable Kernel Was Found In Defined Apt Sources

Apr 28, 2015

I am currently trying to install Debian 8 "Jessie" AMD64 on a Dell Latitude E7240. I have two 256 GB SSD disks, on the first one I have installed Xubuntu 14.04 successfully. I want to install Debian 8 (XFCE) on the other one.I have tried using Debian-8.0.0-Live-amd64-xfce, Debian-8.0.0-amd64-DVD and Debian-8.0.0-amd64-netinst, all from a USB key (prepared with Unetbootin), but after successfully partitionning SSD disk, the installer raises the following issue:"no install-able kernel was found in the defined apt sources".

View 3 Replies View Related

Software :: What Kernel File Holds The Functions For The Hardware Configuration

Jan 12, 2010

what kernel file holds the functions for the hardware configuration. I'm interested in finding the hardware timer of the linux and the DMA configuration file. I assume there is a single file that holds configuration data for the platform.This probably is executed before the kernel is started. As is see it this must be some hardware abstraction layer file because the actual kernel code is not platform dependent.

View 1 Replies View Related

General :: Deleted The /etc/rc.d/functions Folder And Functions.d Script And Turned Arch Machine Into A Brick?

Mar 19, 2011

None of my daemon scripts work now, and the startup process displayed errors. Should I reinstall the OS and start from scratch, or is there a way to recover these files? Is there a way to rebuild the files I deleted?

View 2 Replies View Related

Programming :: Where Are Described Functions That Can Be Used With Stap

Mar 26, 2011

could you please explain few questions about systemtap.

1st
===
seems gettimeofday_s() always returns 0 Code: stap -ve 'probe timer.s(4){ printf("%d ",

[code]....

View 2 Replies View Related

Programming :: Definitions For C Library Functions ?

Apr 24, 2010

Where are the definitions for C library functions located? It was just recently that I realized that header files don't actually define any functions, they merely include their prototypes.

For instance, stdio.h includes the following line:

Code:

This just means that the definition of printf() is located in another file. What file? Is there some kind of default shared object file that is automatically included during compilation?

View 2 Replies View Related

Programming :: C With Gcc: Are All Variables Defined Like Pointers

Sep 13, 2010

i'm practicing in very basic c programs using the gcc compiler.I found that when i create two variables let's say

Code:

int a,b and Code: a=15;
b=3;
a=b;
b--;

then a equals 2.I thought that this isn't normal in C isn't it?I haven't had the time to read the gcc documentation yet...so i think it has something to do with my compiler's default settings.I use the

Code: gcc filename.c -o filename command to compile

Are all variables defined like pointers?

View 5 Replies View Related

Programming :: Unable To Use An Alias In The Ksh Functions

Apr 4, 2011

I have problem to use an alias that defined in ksh93 script,in the functions in the same script onm Linux.I definied an alias in main: alias echo='echo -e' in order that echo will read backslashes but when i executed it in function, the alias didnt work, and performewd a regular echo, without -e

cat test.ksh
#!/bin/ksh
alias echo='echo -e'
checkUsage

[code]....

View 1 Replies View Related

Programming :: Check The Db For Some Value And Run Some Functions To Do Some Checks?

May 15, 2011

have an application where from time to time I need to check the db for some value and run some functions to do some checks. is the best option do it as php daemon or cron job?Whatworried of cron job is the overalapping.

View 9 Replies View Related

Programming :: Defining Functions - What Is The Difference?

Aug 12, 2010

But what is the difference between this...

Code:
my_fucnction () {
echo "Hello World"
}
Code:
function my_fucnction {

[Code]...

View 10 Replies View Related

Programming :: NameError: Global Name 'set' Is Not Defined

Apr 17, 2011

I have a Red Hat 4.9 server running python 2.3.4. However I need some of the new functions so I downloaded and installed Python 2.7.1. I wanted to use the "set" function which was not in the earlier version.

/bin/python is 2.3.4
/usr/local/bin/python is 2.7.1

I have a script running 2.3.4 which calls the 2.7.1 script however it fails because it cannot find the "set" command here is an example

Script1
#!/bin/python
import Mytest

[code]....

The error message is :

NameError: global name 'set' is not defined

View 14 Replies View Related

Programming :: Multithreading For Callback Functions

Jan 4, 2011

Im implementing a chat application using Jabber/XMPP and gloox framework which should send and receive messages concurrently in Ubuntu Linux.

The problem faced is both the threads are created and pthread_join( ) is called for both.The iSend thread is scheduled first but gets suspended at cin. Once the recv( ) function is called, which runs in iRecv thread, the recv call back function handleMessage( ) is called. However the control never shifts back to the iSend thread which should call SendMessage( ) function.

View 1 Replies View Related

Programming :: Nesting Switch Functions In C?

Apr 12, 2010

I am trying to write a simple program in C that involves nesting switches. For example switch 1 offers an option to go to module 1 or 2 or quit. when I go to module 1 there is another switch function offering two or more choices.

I can select either module 1 or 2 at the start of the program and the selection text for, say, module 1 prints to screen but then exits without allowing a second selection to be entered.

I tried using free([first selection]) thinking that might do the trick but it doesn't.

Is it possible to next switches on after another in C?

View 14 Replies View Related

Programming :: Macos Does Not Have Barrier Functions?

May 9, 2010

The pthreads library on macos does not have barrier functions (pthread_barrier_t ....). Is there a way to get around this? I know I can do :

#ifdef __APPLE__
pthread_barrier_t ...
#else
my_barrier ...
#endif

But I would like to avoid this approach as there are a lot of places in my program where I would have to make this change. Can I perhaps rebuild the pthreads library on macos without affecting other apps ?

View 2 Replies View Related

Programming :: Python - Global Name Not Defined

Jun 17, 2011

I found an interesting screencast online about how to make gtk Pyton apps. The thing is, though, the guy was using the interactive shell. I've been trying to get his code into a script, and have been having troubles.

Here's what I got:

Code:

It spits out the error "NameError: global name 'browser' is not defined"

I know I'm doing something wrong with how I'm telling it where to find "browser" and "text", but I can't figure out how to point it to the right place.

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved