Quantcast
Channel: User Guillaume - Stack Overflow
Browsing index pages (35 articles)

Answer by Guillaume for Is unmap_and_move_huge_page() splits huge page into...

No, unmap_and_move_huge_page() will not split pages. If PageHuge() returns true (so when unmap_and_move_huge_page() is called), we know that the page was allocated by hugetlbfs (see...

View Article


Answer by Guillaume for Area between BSS segment and program break (heap end)

All this depends on your OS. I am going to assume you're running Linux. Most distros ship with kernel.randomize_va_space=2 which randomizes the heap address.You can print the list of mapped addresses...

View Article


Answer by Guillaume for virtual to physical address conversion in linux kernel

It's not really "assembly" as there is no instruction in this macro per se.It's just a macro which inserts instr (an instruction passed to the macro) which has one input operand from, one immediate...

View Article

Answer by Guillaume for How to initialize a bitset type all bits to 1

You can use std::bitset<100> = std::bitset<100>(std::string(100, '1')) but it's a bit ugly imo

View Article

Answer by Guillaume for Malloc errors when using POSIX threads on OSX

There are a bunch of problems with this code. It's hard to say why it's crashing on these files considering the number of potential problems (you did not provide a sample input that crashes your...

View Article


Answer by Guillaume for How are the ntoh functions implemented under RHEL/GCC?

These are implemented in glibc. Look at /usr/include/netinet/in.h. They will most likely rely on the glibc byteswap macros (/usr/include/bits/byteswap.h on my machine)These are implemented in assembly...

View Article

Answer by Guillaume for Unix : Restricting a directory to an user

You can't do that because a.out is not reading the file when you use <. The shell is. You need to change a.out so it takes an argument, then you'll be able to run sudo -u dummy ./a.out...

View Article

Answer by Guillaume for Link error between C and assembly

It seems to me that you compiled your foo.c as C++, hence the linking error. What made me say that is that the linker reported the full prototype of the missing function. C functions do not have their...

View Article


Answer by Guillaume for Is this the correct way to thread sync with out mutex

Without knowing exactly what you're trying to do, it is hard to say it is the "correct" way. That's valid code, it's a bit janky though. There is no guarantee that the "Checker" thread will ever see...

View Article


Answer by Guillaume for Catching SIGCHLD using sigtimedwait() on BSD

I think this is a kernel/library bug in FreeBSD. It looks like sigtimedwait is not reporting the signal because it's ignored by default. So you could do 2 thingsInstall a signal handler for SIGCHLD...

View Article

Answer by Guillaume for Hybrid mutex library for Linux

The glibc already provides this. Just use the PTHREAD_MUTEX_ADAPTIVE_NP type or use PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP as the mutex initializer.See...

View Article

Answer by Guillaume for Taking a long time to close fstream

You're writing a fair amount of data. Your problem might be due to buffering. I would try the unbuffered C api if I were you:FILE *fd = std::fopen("/home/username/Desktop/file.bin", "w");if (!fd) { //...

View Article

Answer by Guillaume for how to check out wordsize on linux

Well, it depends on the platform. First, there are some requirements set by the C standard and/or the POSIX standard if you use UNIX. Things like sizeof(int) <= sizeof(long) or sizeof(char) == 1Then...

View Article


Answer by Guillaume for scanf/getchar working correctly only first time...

You need to digest the newline after the scanf. You can do what you're doing above in the code:scanf(" %d", &n);while(getchar() != '\n');first = add_to_list(first, n);

View Article

Answer by Guillaume for Nasm / Assembly How to write this pseudocode

div does not take two arguments. It divides edx:eax by the argument if it's a 32-bit value. See http://www.posix.nl/linuxassembly/nasmdochtml/nasmdoca.html for example.A quick fix would be (could be...

View Article


Answer by Guillaume for PHP/Linux: Does 'kill -9' equate to SIGKILL?

Yes, signal 9 is SIGKILL. You can run kill -l and see the list of signals with their number (the man page signal(7) has also more information).However this case is useless. SIGKILL cannot be caught by...

View Article

Answer by Guillaume for opening a file gives a sYSMALLOc assertion failure

You're not giving the declaration of sequence. Is it a char array or an int array? If it is an int array, your malloc is wrong, it would need to allocate keyword_size * sizeof(int) bytes

View Article


Answer by Guillaume for C++ Server Connection Issue

Your problem is your call to getaddrinfo(). This function returns information in the host_info_list member. What you're reading is the hint (host_info) which is not changed by getaddrinfo(). You would...

View Article

Answer by Guillaume for NASM Assembly Programming - Incrementing an Address

%esi is a register. It can contain an address, your bank account balance or anything else. There is no way the cpu knows what kind of value it contains. inc is simply an arithmetic instruction that...

View Article

Answer by Guillaume for c++: Storing an adress as string

The simplest way is to dochar buf[sizeof(void*) * 2 + 3];snprintf(buf, sizeof(buf), "%p", /* the address here */ );

View Article
Browsing index pages (35 articles)


Latest Images