Programming :: Access In-memory Structure And Its Members?

Dec 13, 2010

I am implementing c program to access ext3 file system's metadata. I want to know how to access members of the in-memory superblock structure. I am able access on-disk ext3_super_block structure but dont know how to access in- memory structure and its members.

View 1 Replies


ADVERTISEMENT

Programming :: Assembly - Structure References To Members - Get The Values 403004h And 4

Jul 9, 2011

[Code]....

if the address of stWndClass is 403000h, WHY it would be compile as mov eax,[esi+403004] and the first one would be mov eax,[esi+4]? I know how to get the values 403004h and 4,but do not know why.

View 5 Replies View Related

Programming :: Data Structure To Manage Memory?

Oct 1, 2010

I have a mxn matric (which is my simplified way of saying it is RAM with bytes on it) Some of the locations on this metric is filled with some data and some places are empty. The mxn are very big numbers in size. I am trying to make a program so that if a system call wants to write some thing on empty locations on this mxn metric it should be able to do so without any problem. The thing which I want to understand or logic of a data structure is what data structure do you people feel should I be maintaining so that I can allocate the requested space immediately from the above mxn matric when some system call requests for some (k) number of locations from above metrics.

The logic initially I thought was to maintain a hashtable

1bytes requested----------> location 1,location 2,location 3.........location n
2bytes requested----------> location 1,location 2,location 3.........location n
3bytes requested----------> location 1,location 2,location 3.........location n

[code]....

but the problem with above logic is size of the pointers where I will be writing this problem is unsigned 64 byte.So to know location of one free byte if I am maintaining one pointer of type u64 this is not a feasible solution.

View 6 Replies View Related

Programming :: Memory Allocate In Function And Call It By Reference For Array Structure?

Jul 2, 2011

I am writing a function(in C language in Linux) to initialize an array of a structure from a mysql table by calling a function by reference but I have a problem with call this function by reference . this is my program:PHP Code:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

[code]...

View 4 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 :: How To Do A Direct Memory Access

Jul 26, 2011

I have a single board computer previously running DOS. I recently made Linux running on it. Now that the system is running Linux, I have to translate the code that was supported by DOS. The code has segments that allow direct access of memory mapped registers through the macro _MK_FP and do read/write. I have read that where DOS allows this kind of direct memory access, Linux does not. Is there a way to do this in Linux?

View 6 Replies View Related

Programming :: Access Another Process's Memory With A Twist?

Jul 31, 2010

I have been looking for a method for a while now that would allow me to access another process's memory without causing it to freeze. But with all of my googling I have found nothing

so, my question is: Is there a way to not lock a process while accessing it's "/proc/[PID]/mem" interface?

View 3 Replies View Related

Programming :: Gdb Reports - Cannot Access Memory At Address 0x8049088

Jul 11, 2011

Kernel 2.6.21.5, slackware 12.0
nasm 2.03.01
ld 2.17
GNU gdb 6.6

This GDB was configured as "i486-slackware-linux".

Code:

What could the cause of the message output by gdb possibly be? Reading some tutorials, I've learn the flat memory model is used in linux. So, in particular, I needn't care about the DS segment register.

Also, line 7 in the listing above, suggests nasm is assuming 32-bit addressing and so, I think it is using the flat memory model.

View 3 Replies View Related

Ubuntu Servers :: Cache Directory And File Structure In Memory?

Aug 11, 2010

i am running Ubuntu Lucid x64 as a fileserver that shares its files via SFTP, NFS and Samba. Currently the hard disks are configured to go to standby if they are not needed. This works perfectly as long as no one browses the shares or my HTPC is running: That one repeatedly looks through the shares for new music or movies. In other words my problem is that the disks are spinning up a lot more often than they should have to. Additionally the spin-up time delays the response time while browsing. Since the machine has a lot of unused RAM i want to tell the kernel that it should keep the directory structure in memory. That way the disks would not need to spin up every time someone browses through the directories.

View 2 Replies View Related

Programming :: Function Pointers To Class Members Cpp

May 23, 2010

i'm a bit stuck playing with the following class setup for glut. The actual issue is with the function pointers.Basically the following code is the opengl redbook cube example slightly modified.

View 2 Replies View Related

Programming :: C++: Assignment Operator Copy All The Members Also For Structures Containing STL Objects?

Sep 26, 2010

does the assignment operator copy all the members also for structures containing STL objects strings,vectors,vectors of vectors...)? I did try it on my platform,and it works that way (copying all the fields),but i was wondering if it is a standard behavior or not.

View 2 Replies View Related

Programming :: Access/Print A C Variable "as It Is Stored In The Memory"?

Oct 23, 2010

I would like to access/print a C Variable of any type "as it is stored in the memory". I would expect the output to be an array of bits. Whats the simplest/shortest way to do that?

View 14 Replies View Related

Programming :: Access At Physical Address - I/O Address In My Map Memory?

Dec 17, 2008

When I try to access at physical address (0xD0000), we known that it is necessary to convert physical address to virtual address using function IOREMAP(0xD0000, 1024) and return me 0xC00D0000.

Now our doubt is when I have a board with I/O in address 0x150, is it necessary to convert this address to other virtual address??? or with inb(0x150) return me state of I/O in this address? How can I known where is this I/O address in my map memory?

View 7 Replies View Related

Programming :: Memory Leaks - Glibc Detected - ./SuffixTree: Malloc() - Memory Corruption - 0x00

Mar 21, 2011

I am new to C and linux. My code below does arbitary writes but I cant figure out where or how it does it.

I am calling the insertNode() function with seq = 'MISSISSPPI$' and alphabets = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ$'

Code:

Weird behaviour I should mention is that when I check for NULL pointer in node->child[index], the unassigned values are not null anymore, they point to arbitary memory.

View 12 Replies View Related

Programming :: Write A Script That Can Show Me Total Memory Vs Used Memory?

Apr 13, 2010

How do I write a script for my Linux that can show me total memory vs used memory and have it email me results if it's over 70 percent?

View 2 Replies View Related

Programming :: SHM Memory Counted As Cache Memory With Kernel 2.6.18?

Aug 25, 2010

Is that possible that SHM shared memory is counted as cache memory on Linux with kernel 2.6.18?If find it really odd since this memory is not file backed, but I have a piece of code that loads data using shm_open+mmap, and it generates an amount of cache memory in /proc/meminfo that corresponds exactly to the amount of shared memory (I load that data from a file but I am using posix_fadvise(fd,0,0,POSIX_FADV_DONTNEED) to ensure this file is not cached and I made sure that it is working as expected). As far as I know SHM memory was not tagged as cache memory with kernel 2.6.9.If it is the case it is really unfortunate since normally cache memory can be considered to be part of the "available" memory since it can be flushed promptly but this is clearly not the case with SHM memory... Is there an easy way to get the total amount of used SHM memory on a system?

View 4 Replies View Related

Programming :: C - How To Malloc For A Structure

Mar 7, 2010

How do you malloc a struct in C? I have a structure of the form:

Code:
typedef struct child_req_to_parent
{

[code]...

View 5 Replies View Related

Programming :: Initializing A Structure To Zero?

Nov 20, 2009

I have a struct (small instance so not using code brackets )

struct random {
int a;
int b;
}example;

What i am trying is

example={0,0};

and it gives an error how to initialize all the entries within a struct to zero? In the above example i have used integers but what if they are some other data structure for example another structure?

View 2 Replies View Related

Programming :: Structure Of PCI ID Not Clear?

Nov 2, 2010

I am learning Kernel Programming these days I came across a structure

Code:
static DEFINE_PCI_DEVICE_TABLE(rtl8139_pci_tbl) = {
{0x10ec, 0x8139, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
{0x10ec, 0x8138, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
{0x1113, 0x1211, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
{0x1500, 0x1360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },

[Code]...

View 5 Replies View Related

Programming :: Structure Of The Main Function In C?

Sep 22, 2010

I have started learning C and am following Ivor Horton's "Beginning C - From Novice to Professional". I've noticed that in the book the structure of the main function is:

int main (void) however on the internet I found a lot of cases: void main (void)Which one is preferred and why?

View 5 Replies View Related

Programming :: Define A Structure Node In Graph?

Oct 27, 2010

I wanted to implement a graph.By graph I mean to say that I am writing programs for BFS,DFS and other such stuff and want to see them in action. For this I started writing a program.The first entry point is to define a graph. I took a pen and paper and made a graph. Now to be able to code this in C.I defined a structure but I am finding problem in defining this structure. I looked into Google and came across incidence list and adjacency list representation [URL] after understanding that I am not able to understand how do I define my structure that would be a node in graph. Here is what my graph looks like

Quote:

|-----------31
| |
| 2---4---6---8
| |

[code]....

View 3 Replies View Related

Programming :: Structure Pointing To Character Array

Aug 9, 2010

I am currently writing a program using raw sockets. This program is used to send out ARP reply frames. The problem that I have is that I do not seem to be able to fill out a structure that is pointing to part of a character array.

Code:
struct eth_header *eth;
struct arp_header *arp;
char buf[8];
eth = (struct eth_header *)buf;
arp = (struct arp_header *)(buf+sizeof(struct arp_header));

Whilst I can fill out the variables of eth, I cannot fill out the variables of arp. If I fill them out and then send the contents of the array using send to, only the first structure (the ethernet header) is sent out. The rest of the data appears to be the original junk data in the array. I have checked the address of the structure pointer and it is pointing to the right place in the array. If I write a raw sockets program that uses an IP header struct and TCP header struct I can point these into the array and write to both of them without any issues.

The difference here is that the call to socket is different:
Code:
/* For ethernet */
fd = socket(AF_INET, SOCK_PACKET, htons(ETH_P_ARP));
/* For IP */
fd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);

If I just create one structure containing all of the variables needed this gets around the issue, however, I would like to know what I am doing wrong in the first instance.

View 7 Replies View Related

Programming :: Getting Error While Accessing Inode Structure Member / Why Is This?

Dec 16, 2010

I have added new member "i_mymember" to inode on-disk structure in ext3_fs.h file and tried to access this in userspace program, but gives me error that "error: �struct ext3_inode� has no member named �i_mymember� "

I have compiled my kernel source code.

why this error is coming ...?

View 1 Replies View Related

Programming :: Data Structure For Implementing A Text Editor?

Nov 15, 2010

Options:A double linked list with fixed size character arrays. New nodes will be added when previous ones get filled. Dynamic arrays using realloc(). Linked list has the disadvantage of not having an O(1) search like an array but I think using realloc() will be more dangerous since it moves the whole block to a new location and if the new location is not big enough to hold the whole block, realloc fails !! this case will not occur with the linked list since its nodes are scattered.

View 14 Replies View Related

Programming :: C++ - Store A Text File In A Data Structure?

May 25, 2009

I am writting a program that reads a text file (music.txt) & stores it in a Data Structure. I am a novice learning over the internet so I this is something I have never done. How do I do this?

Quote:

Write a program that reads the data from the music.txt file and store it in a data structure. To implement this data structure you must use an array of songs and each song must be represented by a struct with appropriate fields. So far all I can do is open to file to read it (very simple I know) but so far is it correct?

Code:

#include <iostream>
#include <fstream>
#include <strstream>

[code]....

View 3 Replies View Related

Programming :: Ctime() On Ut_tv.tv_sec Of Utmp Structure?

Jul 30, 2010

I'm using ubuntu9.10 (x86_64) and have some code,

Code:
void show_utmp(struct utmp* ent)
{
time_t tmp;
if (ent->ut_type != USER_PROCESS)
return;

[Code]....

View 8 Replies View Related

Programming :: Disable Structure Alignment Using Gcc Compiler Options?

Jan 25, 2010

How can I disable structure alignment feature of gcc using command-line options ?I recently migrated to 64-bit OS, and doubt that I might be experiencing a structure alignment problem due to the new 64-bit architecture.I checked the sizes of the same C-style struct in both x86 and x86_64, and found out that they appear to be different by 20 bytes.I am not sure if this is due to structure alignment or the differences in data type lengths between two platforms.Hence, I will first disable the structure alignment feature, and then check the struct sizes again.

View 3 Replies View Related

Programming :: Compiling Recursive Makefile In Directory Structure

May 18, 2011

I'm having problems with compiling recursive Makefiles in my directory structure:
My folder layout is:
top/|- one/|- one.c (With main function)|- zero.c|- two/|- two.cin my top folder the make file looks like:

Code:
MAKE_DIRECTORIES = one two
.PHONY: all
all: $(MAKE_DIRECTORIES)

.PHONY: $(MAKE_DIRECTORIES)
$(MAKE_DIRECTORIES):
@echo $@
$(MAKE) --directory=$@
in my one and two folder I have the following Makefile:

Code:
.PHONE: all
all:
@echo $@
$(CC) $(CFLAGS) *.c
But when I compile it from top folder: make

I get following output:
Code:
one
two
Which states that directory statement by echo in main Makefile is ok but the files are not compiled in one and two.

View 5 Replies View Related

Programming :: Using Rsync To Copy Only Certain Folders Within A Directory Structure?

Jun 15, 2011

I am trying to create a simple bash script to rsync some folders within a directory stucture. I am using wild cards, in the rsync source directory structure, but my command always fails. I believe it is the way I am using wild cards within my for loop. Here is my command ;

Code:

for seq in `cat test.txt` ; do rsync -nvP /folder/folder/folder/folder/folder/**/$seq /folder/folder/folder/ ; done This always fails, where if I do a ls to the destination, to test the path, it always works.

View 5 Replies View Related

Programming :: Book Which Explains System Library Structure In Depth?

Sep 7, 2010

Has any one ever come across a book on Linux programming which explains a Library structure in depth?

View 3 Replies View Related







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