Search Results

Search found 24814 results on 993 pages for 'linux distro'.

Page 111/993 | < Previous Page | 107 108 109 110 111 112 113 114 115 116 117 118  | Next Page >

  • linux's fork and system resources

    - by Dmitry Bespalov
    Suppose I have following code in linux: int main() { FILE* f = fopen("file.txt", "w"); fork(); fwrite("A", 1, 1, f); fclose(f); return 0; } What I know about fork from documentation, is that it makes the copy of current process. It copies state of the memory as well, so *f should be equal in both instances. But what happens with system resources, such as a file handle? In this example I open the file with write intentions, so only one instance can write into file, right? Which of the instances will actually write into file? Who should care further about the file handle, and call fclose() ?

    Read the article

  • How can I "interconnect" two sockets in Linux?

    - by Vi
    There are two connected sockets. How can I interconnect them? Data appeared on the one socket should be written to the other. EOF/FIN should propogate well. If one is half-closed, the other should also be half-closed. int client = get_connected_client_socket(); int proxy = get_connected_proxy_socket(); negotiate_with_proxy(proxy); iterconnect(client, proxy); // Now forgot about both client and proxy. // System should handle IO/shutdown/close. // Ideally even without any support of the user-space process. Can Linux do it? Can it be done by tricking connection tracking to change tracking status of existing connection? @related http://stackoverflow.com/questions/2673975/determine-how-much-can-i-write-into-a-filehandle-copying-data-from-one-fh-to-the

    Read the article

  • Good simple C/C++ FTP and SFTP client library recommendation for embedded Linux

    - by Roman Nikitchenko
    Could anyone recommend FTP / SFTP client C/C++ library for Linux-based embedded system? I know about Curl library but I need something as simple as possible just to download files from FTP / SFTP servers. Is there any recommendation to look for? Yes, SFTP support is critical. Actually I can even sacrifice multi-threading because I need only one stream at a time. And I'd like it to be able to work through memory buffers but this should be not a problem. Thank you in advance.

    Read the article

  • Ofstream writes empty file on linux

    - by commanderz
    Hi, I have a program which writes its output using ofstream. Everything works perfectly fine on Windows when compiled with Visual Studio, but it only writes empty file on Linux when compiled with GCC. ofstream out(path_out_cstr, ofstream::out); if(out.bad()){ cout << "Could not write the file" << flush; } else{ cout << "writing"; out << "Content" << endl; if(out.fail()) cout << "writing failed"; out.flush(); out.close(); } The directory which is being writen into has 0777 privileges. Thanks for help

    Read the article

  • SSL_accept hangs... sometimes ( C, linux, openssl )

    - by zbigh
    I'm currently working on an embedded linux system. There are two crucial client applications on the system that connect to an external server ( on another embedded system, all written in C ). The two apps use different certificates. The ssl connection works... At least usually, but from time to time an error occures: the server hangs on SSL_accept() when accepting connection from one of the applications - the one using older certificates. Restarting the server application does not help, nor does restarting the client - the only way is to reboot the server system, unless I create a symbilic link to the new certificates used by the other app - only then will restarting the server app work. Never does the error occur when both applications use the same, new certificate. Could this happen due to some strange openssl cache or something like that?

    Read the article

  • How to check whether your code environment on Windows or on Linux or other OS

    - by justjoe
    hi, right now, i code custom wordpress theme and testing it in xampp windows XP on apache server. But as long as i concern, there's no wp build-in function to identify the code environment. Is there's any PHP build-in function to identify such thing ? for the record, what i want to code need to read a directory. in my apache (in windows), the path will be c:/xampp/htdocs where apache on linux will be \somepath\somepath\ so, is there any code solution to know what is the OS environment without i have to compare the path ? i hope it will also work on other OS with other webserver then APACHE such as IIS

    Read the article

  • What is linux equivalent of running a .bat file on windows from PHP using system()

    - by undefined
    I have a PHP script that runs a .bat file on my windows machine using $result = system("cmd /C nameOfBatchFile.bat"); This sets some environmental variables and is used to call Amazon EC2 API from the command line. How do I do the same from a Linux server? I have renamed my .bat file to a shell (.sh) and changed the script to use 'export' when setting env vars. I have tested by running the code from a putty terminal and it does what it should. So I know the commands in the script are good. How do I run this from PHP? I have tried running the same command as above with the new filename and I don't get any errors, or file not found etc but it doesn't appear to work. Where do I start trying to solve this?

    Read the article

  • prevent linux thread from being interrupted by scheduler

    - by johnnycrash
    How do you tell the thread scheduler in linux to not interrupt your thread for any reason? I am programming in user mode. Does simply locking a mutex acomplish this? I want to prevent other threads in my process from being scheduled when a certain function is executing. They would block and I would be wasting cpu cycles with context switches. I want any thread executing the function to be able to finish executing without interruption even if the threads' timeslice is exceeded.

    Read the article

  • Recursively disabling CONFIG dependencies on linux kernel builds

    - by Corey Henderson
    When configuring a Linux kernel, I normally start with my distribution's kernel config file. I often want to turn off some entries, but they are sometimes unchangeable because other CONFIG options that depend on it are enabled. I can look up the dependencies manually, which often have dependencies of their own. It can be pretty time consuming to did through them all, especially if you're trying to turn off something like CONFIG_KALLSYMS. Is there a way to specify a CONFIG option you want gone, and have all dependencies automatically selected/disselected as nessisary for you? I looked through all the make options and in the scripts directory, and didn't see anything available for this.

    Read the article

  • Problems with system() calls in Linux

    - by Thomas
    I'm working on a init for an initramfs in C++ for Linux. This script is used to unlock the DM-Crypt w/ LUKS encrypted drive, and set the LVM drives to be available. Since I don't want to have to reimplement the functionality of cryptsetup and gpg I am using system calls to call the executables. Using a system call to call gpg works fine if I have the system fully brought up already (I already have a bash script based initramfs that works fine in bringing it up, and I use grub to edit the command line to bring it up using the old initramfs). However, in the initramfs it never even acts like it gets called. Even commands like system("echo BLAH"); fail. So, does anyone have any input?

    Read the article

  • Question about regex in linux commands.

    - by smwikipedia
    I ran the following command at linux bash: apt-cache search hex.*(view|edit) My intention was to find any software packages whose name/description contains the pattern 'hex.*(view|edit)'. But among the results I got this: kipi-plugins - image manipulation/handling plugins for KIPI aware programs How could this be in the results list? I didn't see any matching string in this result. Is this a bug of the apt-cache search command? Or do I mis-understand how the regex is used by this command? Many thanks.

    Read the article

  • Error during installation of Mesa on Linux

    - by rodnower
    Hello, I have a problem. I try to install Mesa 7.8 on CentOS 3.9 for i386 on VMVare 7.0.1 like described here: http://linux-sxs.org/multimedia/mesa.html When I perform configuration stage: ++++++++++++++++++++++++++++++++++++++++++++++++++ [root@CentOS Mesa-7.8]# ./configure --prefix=/usr --sysconfdir=/etc ++++++++++++++++++++++++++++++++++++++++++++++++++ (root is actualy root) This is what I get: ++++++++++++++++++++++++++++++++++++++++++++++++++ . . . checking pkg-config files for X11 are available... no checking for X... no configure: error: X11 development libraries needed for dri driver ++++++++++++++++++++++++++++++++++++++++++++++++++ (Three dots says that there is some output before) Put attention to error. Any idea? Thank you very much forahead.

    Read the article

  • Port a Rails App from Windows to Mac or Linux

    - by Ryan Max
    Hello I've been a Rails developer on Windows for quite some time now, but I recently completed my biggest project yet (it's quite extensive, took me over a year to build) but I am having trouble deploying it. The combination of it's size, complexity and a windows environment is making it needlessly complex to deploy. I am thinking about getting an old mac mini and using it just for rails development. Either that or install unix on another box. Is there any way I can port my app to this mac or linux machine, without having to start over? I can't find any resources on the internets about this.

    Read the article

  • Per Process Memory Calculation Alogrithm in Linux (say kernel 2.6 and above)

    - by Vaibhav Singh
    How do you calculate the linux process's Acutal Memory Usage and Not Virtual Memory Usage through the information supplied by /proc//smaps or maps or status or stat. To be more precise I need the heap usage only. I need to do this on an PowerPc based embedded system and hence I do not have utilities like exmap, valgrind etc. I understand the concepts of shared/non shared memory. I have read through the other topics given in this forum about the same but they talk more using the tools mentioned. What I need is the native way of calculation done by the same tools so that I may write a shell script for the same.

    Read the article

  • Reason for different segments in Linux on x86

    - by anjruu
    Hey all, So, I know that Linux uses four default segments for an x86 processor (kernel code, kernel data, user code, user data), but they all have the same base and limit (0x00000000 and 0xfffff), meaning each segment maps to the same set of linear addresses. Given this, why even have user/kernel segments? I understand why there should be separate segments for code and data (just due to how the x86 processor deals with the cs and ds registers), but why not have a single code segment and a single data segment? Memory protection is done through paging, and the user and kernel segments map to the same linear addresses anyway. Thanks! anjruu

    Read the article

  • Memory allocation in Linux

    - by Goofy
    Hello! I have a multi threaded application where I allocate buffers with data, which then wait in queues to be send via sockets. All buffers are reproducible because I use only buffers of fixed size in whole program (1024, 2048, 2080 and 5248 bytes). I noticed, that my program usually use up to 10 buffers of each length type at the same moment. So far I always manually allocate new buffer and then free it (using malloc() and free ()) where it's not needed any more. I started wondering if Linux is enough smart to cache this memory for me, so next time I allocate new buffer system only quickly receive a buffer I have already used before and not perform heavy operation of allocating new memory block?

    Read the article

  • Raising hard limit on RLIMIT_NOFILE system-wide on Linux

    - by jonswar
    We need to raise RLIMIT_NOFILE when running memcached, as we're hitting the default hard limit (1024). However, raising a hard limit requires root, and for various reasons we don't want to have to run memcached or its containing shell as root. Right now we happily run it as a non-root user. Is there a way to raise the hard limit for RLIMIT_NOFILE system-wide, so that we can continue to run memcached as non-root and simply raise the soft limit? This is RedHat Linux with 2.6 kernel. Thanks! Jon

    Read the article

  • How to get notified of modification in the memory in Linux

    - by Song Yuan
    In a userspace program in Linux, I get a piece of memory via allocation from the heap, then the pointer is distributed to a lot of other components running in other threads to use. I would like to get notified when the said piece of memory is modified. I can of course develop a custom userspace solution for other components to use when they try to modify the memory. The problem in my case is that these are legacy components and they can write to memory in many occasions. So I'm wondering whether there is a similar API like inotify (get notified when file is changed) or other approaches in order to get notified when a piece of memory is changed. I considered using mmap and inotify, which obviously won't work if the changes are not flushed. Any suggestions are appreciated :-)

    Read the article

  • How can I login linux using C or C++

    - by jnblue
    I need to programmely switch the current user to another,then the followed code should be executed in the environment(such as path,authority..) of another user. I've find the 'chroot()','setuid()' may be associated with my case, but these functions need the root authority, I don't have root authority, but I have the password of the second user. what should I do? I have tried shell "su - " can switch current user, can this command help me in my C++ code? Don't laugh at me if my question is very stupid, I'm a true freshman on linux. :) Thanks!

    Read the article

  • Find original owning process of a Linux socket

    - by Rob H
    In Linux and other UNIX-like operating systems, it is possible for two (or more) processes to share an Internet socket. Assuming there is no parent-child relationship between the processes, is there any way to tell what process originally created a socket? Clarification: I need to determine this from "outside" the processes using the /proc filesystem or similar. I can't modify the code of the processes. I can already tell what processes are sharing sockets by reading /proc/<pid>/fd, but that doesn't tell me what process originally created them.

    Read the article

  • Linux File Permissions & Access Control Query

    - by Jason
    Hi, Lets say I am user: bob & group: users. There is this file: -rw----r-- 1 root users 4 May 8 22:34 testfile First question, why can't bob read the file as it's readable by others? Is it simply that if you are denied by group, then you are auto-blacklisted for others? I always assumed that the final 3 bits too precedence over user/group permission bits, guess I was wrong... Second question, how is this implemented? I suppose it's linked to the first query, but how does this work in relation to Access Control, is it related to how ACLs work / are queried? Just trying to understand how these 9 permission bits are actually implemented/used in Linux. Thanks alot.

    Read the article

  • Edit very large sql dump/text file (on linux)

    - by geo
    I have to import a large mysql dump (up to 10G). However the sql dump already predefined with a database structure with index definition. I want to speed up the db insert by removing the index and table definition. That means I have to remove/edit the first few lines of a 10G text file. What is the most efficient way to do this on linux? Programs that require loading the entire file into RAM will be an overkill to me.

    Read the article

  • Limit output of all Linux commands

    - by daniel
    I'm looking for a way to limit the amount of output produced by all command line programs in Linux, and preferably tell me when it is limited. I'm working over a server which has a lag on the display. Occasionally I will accidentally run a command which outputs a large amount of text to the terminal, such as cat on a large file or ls on a directory with many files. I then have to wait a while for all the output to be printed to the terminal. So is there a way to automatically pipe all output into a command like head or wc to prevent too much output having to be printed to terminal?

    Read the article

  • In linux, is it possible to do partial reads on a regular file

    - by Jimm
    I need to write an application that spits out log entries to a regular file at a very fast rate. Also, there will be another process, that can read the same file concurrently at the time, other process would be writing to it. I have following questions How does read() determine EOF, specially in the case, where the underlying file could be concurrently being modified? Is it possible for read() to return partially written data from the other process write? For example, the write process wrote half a line and read would pick that half line and return? The application would be written in C on linux 2.6.x using Ex4 filesystem UPDATE: Below link points to the patch, that locks inode in EXT4, before reading and writing. http://patchwork.ozlabs.org/patch/91834/

    Read the article

  • Why can't I view a directory in Linux?

    - by Thread7
    I am setting up a Linux web server running apache. I uploaded and untared my web sites files. The files in the main directory are all visible when I am SSH'd into the system. However, I am blocked from all subdirectories. If I write: # cd images Then I get the error: -bash: cd: images: Permission denied I am signed in as ec2-user. I untarred the stuff as ec2-user and I doubt there was any permissions in the tar file since I created the archive on a Windows system. The weird thing is that I am the owner of this directory. Here is a snippet of the command: ls -l drw-rw-r-- 19 ec2-user ec2-user 4096 May 4 04:09 images When I do "sudo su" and then type the command cd images everything is fine. Why do I get "Permission denied" as ec2-user if I am the owner and have rw permission?

    Read the article

< Previous Page | 107 108 109 110 111 112 113 114 115 116 117 118  | Next Page >